• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

diagonal movement in a GameCanvas

 
Diego Tori
Greenhorn
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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic