Page 1 of 1

Diagonal Movement

PostPosted: Mon Oct 04, 2010 10:28 pm
by BlenderFreak
So I know the codes for making a char move left, right, forward, and backward (the game is top view, so it's forward and backward rather than up and down), but in the game I'm making I'd like for the character to have the ability to move diagonally as well. Does anyone know of a simple code that will do this? Initially I thought that it was a simple matter of combining the x and y velocity, but for some reason that didn't work so well... maybe it's my incompetence. XP Thanks to anyone who helps!

Re: Diagonal Movement

PostPosted: Mon Oct 04, 2010 10:36 pm
by skydereign
Well it should be a matter of combining the xvelocity and yvelocity movement. Or if you have keydown events on repeat, with x+=5, and y+=5, then by pressing the two keys, the player will move diagonally.

Re: Diagonal Movement

PostPosted: Mon Oct 04, 2010 10:40 pm
by BlenderFreak
Hm yeah that's what I thought... I'll check my code later though :)