Game Development Community

Grid-based movement

by Hasitha · in Torque Game Engine · 06/15/2008 (7:41 pm) · 3 replies

Does anyone have an idea on how to apply grid-based movement to the player?
As in, when you hit the 'A' key, the player will move left exactly 5 yards, regardless of how long you hold down the key?

I've been messing around with the $mvForwardAction (and related vars) variable and using a schedule to stop movement, but that's not working right and it's probably not the best way.

Any ideas?

#1
06/17/2008 (5:19 am)
Hasitha - The easiest way I've found to do this is to change it so that your player uses ther AIPlayer class rather than Player class, then use something like %aiplayer.setMoveDestination() function call (I think that was it but it's from memory)
#2
06/18/2008 (8:35 pm)
Hmmmm...I never thought of that. I will try it out and see how it works. Thanks for the help. :)
#3
06/20/2008 (7:48 am)
It should work out great for you, it's what I used to create a chess prototype in TGE