It isn't perfect, but this can act as a temporary replacement until "if on edge, bounce" works in Leopard. You'll have to tweak the numbers on the right side of each > block depending on the size of your sprite (so that it bounces when it hits the edge, not before or after).
https://leopardjs.now.sh/?id=409768494