I have a student who is beginning to design her game. She wants the “player” sprite to bounce off the edge of the background. We know how to make a sprite bounce off another sprite but can we code a bounce off the edge of the screen\background. She worked around it by coding conditions for the x and y locations and changing the velocity depending on its location but we’re still wondering about coding a bounce off the edge of the background. Here is what she has so far:
Thanks in advance.