Student Issue with U3L27

My student and I are having a hard time getting his sprites (the barrel and Mario) to move smoothly on the screen in a diagonal direction. Please look at his code to see what we have missed or are doing wrong. Thank you!


I can’t see that your student has tried coding any movement for the barrel. Am I missing something?

The general idea of diagonal movement would be to have it move in equal steps both vertically and horizontally at the same time (so move down one pixel and to the left one pixel).

For the player, since you are using keyboard controls, you would have to program a key for diagonal movement. If not, the person playing the game would dictate the movement.

Give it a shot and let us know if you try and can’t get it to work and we can possibly give you some more help.

Best of luck!