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

**URL:** <https://forum.code.org/t/my-student-wants-his-arrow-to-rotate-after-all-of-his-other-sprites-have-appeared-and-he-has-hit-the-space-bar-5-times/38009>\
**Category:** Coding and Debugging Help\
**Tags:** csd-unit-3\
**Created:** [April 21, 2023, 12:42pm UTC](https://forum.code.org/t/my-student-wants-his-arrow-to-rotate-after-all-of-his-other-sprites-have-appeared-and-he-has-hit-the-space-bar-5-times/38009 "2023-04-21T12:42:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwatson](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@jwatson](https://forum.code.org/u/jwatson)\
**Post date:** [April 21, 2023, 12:42pm UTC](https://forum.code.org/t/my-student-wants-his-arrow-to-rotate-after-all-of-his-other-sprites-have-appeared-and-he-has-hit-the-space-bar-5-times/38009/1 "2023-04-21T12:42:03Z")

</div>

[[Game Lab - Code.org](https://studio.code.org/projects/gamelab/1YEVsHaizLo14NBdLotlmEQBsJNQQlA2W0fmRB5Ts28)]  
**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.

---

<div class="post-metadata">

**Author:** ![melynn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/melynn/32/4925_2.png) [@melynn](https://forum.code.org/u/melynn)\
**Post date:** [April 21, 2023, 3:44pm UTC](https://forum.code.org/t/my-student-wants-his-arrow-to-rotate-after-all-of-his-other-sprites-have-appeared-and-he-has-hit-the-space-bar-5-times/38009/2 "2023-04-21T15:44:16Z")

</div>

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](https://studio.code.org/projects/gamelab/fPC9WowKU6WpjCwFAeTXy9Hf5C1rgY4GqNkMoRan6RU) 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!  
~Michelle
