I am having trouble with why the sprite rotation isn’t working. It isn’t responding to the key press. Can you help?
[Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]
You are declaring the sprite variables in the draw loop, causing the same variables to be created each frame. This can be easily fixed by moving the sprite creation outside of the draw loop, including the background drawing function; it’s not needed.
The next problem is how you rotate it. You are setting the rotation. Not adding/subtracting it. So you should use the operators like -= or +=.
if (keyDown("up")) {
attatchment.rotation += 3;
}
if (keyDown("down")) {
attatchment.rotation -= 3;
}