Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

diagonal movement in a GameCanvas  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I'm having trouble creating a method which is piped through the main game loop which keeps an eye on user input in the form of key presses in order to move a sprite around in eight directions. I know that in order to map diagonals, I would have to use the number pad (1,3,7,9). With that said, I'm having trouble with the math involved in moving a Sprite in diagonal a direction, in particular, the rate in which the x and y coordinates move relative to that position.

I have the original method that needs epxanding:
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!