Diagonal Movement

Non-platform specific questions.

Diagonal Movement

Postby BlenderFreak » Mon Oct 04, 2010 10:28 pm

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!
There's not much there yet, but you can find information on my current projects here.

https://sites.google.com/site/darkst3am/
User avatar
BlenderFreak
 
Posts: 55
Joined: Sun Sep 26, 2010 5:46 am
Location: His Computer
Score: 2 Give a positive score

Re: Diagonal Movement

Postby skydereign » Mon Oct 04, 2010 10:36 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Diagonal Movement

Postby BlenderFreak » Mon Oct 04, 2010 10:40 pm

Hm yeah that's what I thought... I'll check my code later though :)
There's not much there yet, but you can find information on my current projects here.

https://sites.google.com/site/darkst3am/
User avatar
BlenderFreak
 
Posts: 55
Joined: Sun Sep 26, 2010 5:46 am
Location: His Computer
Score: 2 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest