1
$\begingroup$

I am currently developing a concept of a game, and a critical part is the character navigation. The game is based on a 2D grid, and I need to be able to navigate one block at a time, in only straight lines.

If it makes it easier, the scaling is non-critical, so grid blocks can be one Blender unit.

$\endgroup$
2
$\begingroup$

Your request is pretty simple.

Limit any movement to:

  • 90 degree turns
  • steps of 1 BU size
  • do not use the physics engine

This assumes you want to move in discrete steps (in frame t the object is at A and in frame t+1 the object is at B without any intermediate steps).

$\endgroup$
1
$\begingroup$

The Game Engine is by default a 3D rigid body simulator, so such constraints, like forcing objects to grid positions and limiting movement to one unit along one axis at a time, will have to be programmed with the Logic Editor and Python scripts. Basically you will have to program a different game engine for your 2D game inside Blender. If you are lucky you will find libraries and modules for a 2D grid-based game to help you make this.

Some quick notes for the engine:

  • Game objects will have "moving" and "waiting" states.
  • In "moving" state the object is not on a grid point, but moving/animating between two points. The object will store the earlier point and the destination, and a timer value. These three are used to visually animate the movement by interpolating the object position.
  • In "waiting" state the object is sitting on a grid point, and waiting for an event. For the object controlled by the player, that event is player input. For computer controlled objects, that's either a timeout used for making the opponent less speedy, or if that time's up then calculate the next destination and start moving towards that.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.