Using keys to control actions

I’m not sure why the code isn’t working. Shark123 moves around the path, but the student wants- when the space key is pressed to stop swimming around the path and to switch to a new camera. It’s stuck in a loop though. I’ve tried many different codes but nothing seems to stop the path loop. Can you help with this? These are 5th grade students.

Hi @Mary_Beth_Burns,

When you place “When * clicked” CoBlock after the other blocks, the click event will be initialised only after this blocks finish their actions. Also, this CoBlock doesn’t require to be placed inside repeat CoBlock - it is working constantly after the block was reached by the program.
So generally it is better to place the “When * clicked” CoBlock on top of your code.

Feel free to remix and investigate the updated version

1 Like