Pausing and Restarting Sprites

gamelab
#1

Hello! I have a student who is trying to pause several sprites when his mouse hovers over a certain sprite, and restart the movement of the sprites when his mouse moves off of the pause sprite. So far, he has been able to start and stop all of the sprites except one. He has a sprite (called saw) moving with velocity and bouncing off of the “walls” (other sprites). This saw sprite will freeze with the pause and the rotation will unfreeze off of the pause. However, we cannot seem to get the sprite to continue the initial movement. We are using an If…Else statement that says if (mouseIsOver(pause)) { saw.velocityX = 0;
saw.velocityY = 0; } else { (call the function to move the saw) }. Our issue is that if we add velocity into the movement function or simply put it in the Else statement, the saw will indeed move on the unpause. It will NOT, however, continue to bounce off of the walls as it did before the pause.

In short, we are trying to figure out how to make the sprite continue to move in the same way as it did before we paused. Since our code works for the rest of the sprite (which are simply moving with velocity) we feel that our issue must be with the collisions? Any ideas would be greatly appreciated!!

#2

Hi,

Could you post a link to the code from this student? That would make it easier to help with debugging.

Thanks