itch.io is community of indie game creators and players

Devlogs

Tutorial

πŸ“˜ Godot State Machine Blueprint + Barista Frog
A downloadable asset pack for Windows, macOS, and Linux

πŸ“˜ Godot State Machine Blueprint

A ready-to-use, modular finite state machine (FSM) template for 2D Godot projects. This example features two states: Idle and Walk. This blueprint is designed for rapid setup: simply follow the structure shown here, and you won’t need to modify any FSM code. Just add your own nodes, animations, collision shapes, and set the default state in the Inspector.
Perfect for player, enemy, or NPC logic in any 2D game.

❓ How to use

βš™οΈ Node Structure

  • Character: Main entity node (e.g., player).
  • StateMachine: Manages state transitions and logic.
  • Idle/Walk: Example state nodes, each with their own logic.
  • SpriteController: Handles animation and direction.

πŸ—‚οΈ Folder Structure

  • statemachine/: Contains generic, reusable FSM scripts. 
  • player/: Contains player-specific scripts and states.

πŸ“œ Base Scripts

state_node.gd

This is the base class for all states. It defines the interface that all state scripts should implement.

game_state_manager.gd

Manages transitions between different states (such as Idle, Walk, etc.) for any character or game object. Each state is implemented as a child node (extending StateNode), and the manager automatically handles entering and exiting states, as well as calling transition logic each frame.

sprite_controller.gd

Handles sprite animation and direction for the character.

player.gd

Handles player movement, input, and updates the sprite controller.

Files

  • finite-state-machine.zip 3.2 MB
    7 days ago
  • frog-idle.png 3.7 kB
    7 days ago
  • frog-walk.png 4.2 kB
    7 days ago
Download πŸ“˜ Godot State Machine Blueprint + Barista Frog
Leave a comment