I have a student trying to make his ghosts move up the screen continuously after pressing the space bar. They will only move while the space bar is being held down. Here is a picture of the code.
@mindyw, In your image, the conditional if keyDown("space")
evaluates false if the spacebar is not held down. As soon as you hold it down, it evaluates to true. When you release it, since it’s not held down anymore, it evaluates to false again, so they stop moving.
One way to potentially solve the problem would be to create a variable trigger. A variable that is initially set to “false”, but that becomes “true” as soon as the space bar is clicked for the first time.
Then you could replace the conditional on line 12 with a conditional that is checking if your trigger variable has been changed to true.
I hope this helps, but if it’s still as clear as mud, please respond back and we’ll try to explain it better!
Good luck!
Mike