This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin 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:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!