I noticed that Grid-Based Motion is listed
in "The Master List" as being open but with captaincomic's name at the header of the section, and then in the
pre-shipped behaviors for 3.0 thread as being directly attributed to him again. I'm willing to work on this if it's still needed and actually open. It's been several months since either thread were updated so I wanted to check first.
I also noticed that the "Snap To Grid" was needed and I could throw that together as well if also needed.
If I work on this, here's the basic functionality/needs as I understand them. If I've missed anything just point it out - I'll be coming back here to reference these notes if I work on this...
Required Features1. Is an Actor Behavior
2. When enabled, locks the actor's position to a square grid cell.
3. The position of the actor within/around the cell can be customized with X,Y offset attributes (centering the actor is the default location, and then -/+ offsets).
4. The square grid itself can be customized for width and height of the cells, with the current scene's tile size as a default option.
5. The behavior will accept inputs to permit motion of the actor between cells.
a. The user will be able to permit or disallow diagonal motion, or other specific directions (in chess, pawns only move in one direction, for example).
b. Keyboard controls will be configurable for movement to all valid adjacent cells, or continuous motion if held down (if movement is instant, a configurable timer will be needed for this).
c. The behavior will also accept messages from other behaviors to initiate the motion (so a separate touch or mouse-based behavior could send commands for motion, for example)
d. The behavior will also accept a message to send the actor directly to a specific, non-adjacent cell (for teleportation or other long-distance moves). Custom Block required?
6. Motion between cells can be configured with a speed, or be instantaneous.
7. If a collision occurs, the actor should return to the nearest cell and stop.
Additional features7. The behavior could broadcast a message (for other behaviors to receive) every time a move is made. Roguelikes could use this to initiate monster movement (as nothing happens in a roguelike until the player acts). Other uses could be to decrement a "Moves Available" counter, trigger special effects, etc.
8. Select a sound effect for use during motion or when a move is made.