Game Development Community

Grid based movement

by James Mintram · in Torque Game Engine · 10/26/2008 (1:23 pm) · 2 replies

Hi there, I am not too clued up on the inner workings and best proctices with TGE so I am posting here hoping to get some help and advice.

I am looking to write a game where a player navigates a grid using the directional keys, now the thing I am trying to figure out is how to implement the grid based movement.

What I mean by that is keeping the player "locked" to grid positions, so the player might be at 0,0,0 and the player presses foward. The keyboard is then "locked" and the character moves to 1, 0, 0 over x amount of time, once the character has reached that position keyboard control is returned and the player can move again.

I hope you can understand what I am trying to get at!

Many Thanks

James Mintram

#1
11/04/2008 (9:46 pm)
You may use an AIPlayer instead of a Player and command it to move to a specific position which you can compute depending on your grid. I do this for my game. There are some problems if the player is too close to a point and its goind too fast... it may start doing some weird movement and never reach its destination.
If you are proficient with the engine you can just fix this problem (not that simple solution). Otherwise just be careful and adjust the AIPlayer speed properly..

Luck!
Guimo
#2
11/13/2008 (4:28 pm)
Hey thanks for that! Sorry for delay in replying been very busy of late!