Pause a counter pattern

Hello,
I have a student using a counter pattern to run a score as the game is moving. He wants to be able to stop the counter from running when one sprite touches another. I have looked through this thread but am not having any luck. Can you advise how to do this. He has an end game screen set up which works, but the counter still runs though it is “game over”.
Thanks for your help.

Hi @denise.reichard,

Without seeing a shared link to the project, it is a little hard to give advice but I think I know how to solve the issue. You asked how to, “stop the counter from running when one sprite touches another” so I am going to assume that the code is using “isTouching”. There are several ways to stop the score from continuing to count based on the “isTouching” block.

  • When the sprites touch or when the condition to end the game is true, you can add one to score (as I assume is happening) and then the next line of code can randomly move one or both sprites to another position so they no long collide. For example sprite.x = 1000.

  • I’m not sure how the sprites are moving to collide but you could set their velocityx and/or velocityy OR their counter pattern movement to 0 so they no longer move.

  • My students will also use sprite.destroy() when the condition to end the game is true. This will cause the destroyed sprite from being drawn or updated anymore.

Hope these ideas help but if not, post a shared link to the project so we can take another look:)

~Michelle