The theme for this game jam was “An end is a new beginning”. I didn’t have a good idea for this so I decided to create a snake type game.

My goal for this jam was to focus on the player grid based movement.
The player character movement rules were:
- The character can not stop moving.
- They can’t reverse their current direction. For example they can change from going up to going down, they would need to go either left or right first.
- The character can only change directions when in the middle of a grid cell.
The movement works by saving the player’s last movement key press and when the player character is within the next grid cell the code reads in the players requested direction change and if it doesn’t break any of the movement rules the movement is applied.

The other part of the movement was to have all the trailing segments to follow the player character. Each segment saves their move-from and move-to positions and lerps between them. When the head segment (this is the player controlled one) reaches their move-to goal (this matches each grid cell where they can change direction) the new position is calculated based on if the player changes direction or not. Then we iterate through from tail segment to the head and copy the move-from/move-to positions down from head to tail then we apply the new position to the head segment.

The main issue I found with this approach was when the player sequentially changed direction. Only the last change would be run. For example if the player chose to go down then left and the character didn’t go through a grid cell before the first input was executed it would be lost. If I were to update the game I would try to add a buffer that would store multiple inputs that the player added in quick succession.
You can play it here: https://spacecastle.itch.io/animal-train
Jam link: https://itch.io/jam/brackeys-9/rate/1929646