My student wants his arrow to rotate after all of his other sprites have appeared and he has hit the space bar 5 times

[Game Lab -]
What I expect to happen:- He wants the arrow to rotate at the end when z=5 and x=2.
What actually happens: Sometimes the arrow rotates and sometimes it doesn’t.
What I’ve tried: We have tried changing multiple different pieces of code and rerunning the app. I’m not sure what to try next.

Hi @jwatson,

Such a creative game! I love how he figured out the rotation.

I believe the arrow begins rotating only sometimes because of the z variable. If you click the wheel too quickly (before z is set equal to 5), the arrow won’t spin.

There are probably many ways to solve this. One solution I found:

  • Create a variable called spin and set equal to “no” at the beginning of the game.

  • When you click on the wheel, spin turns to “yes”.

  • Create a conditional statement for if spin == “yes” and move all of current rotation code into the if statement. At the end, set a timeout for however long about 5 rotations take. At the end of the timeout, change spin to “no”.

  • Here is a link to my version with the above modifications.

Some other tips: You may not be to lesson 24 yet but this would make an excellent “spinthewheel” function. Also, there is a rotationspeed block that will rotate the arrow. Your student basically coded this block the long way - pretty cool!

Hope this help!