Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

diagonal movement in a GameCanvas  RSS feed

Diego Tori
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:
Message for you sir! I think it is a tiny ad:
Thoughts on deprecation in Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!