Rule of Three

2D pixelart action game about Dazed Blood Demon's quest to get home and take a well deserved bloodbath.

GitHub repohttps://github.com/braticpetar/rule-of-three

About the Game

The rule of three is a writing principle which suggests that a trio of entities — events or characters — is more humorous, satisfying, or effective than other numbers. Having three entities combines brevity and rhythm with the smallest amount of information required to create a pattern.

We explore this idea in an action/adventure game where everything comes in triads.

Three Main mechanics

  • Walk
  • Attack
  • Dissolve / Condense (teleport)

Three Levels

  • Mundane Night City
  • Desert of Lost Souls
  • Home Sweet Home

Three Enemies

  • Soulless Ghostly Wanderer
  • Ivory Death Stalker
  • Grim the Plague Bringer

Design Patterns

  • State Machine: Each entity is a state machine, encapsulated in its own script. States are defined per entity and we switch between them from the entity controller script.
  • Singleton: A global PlayerSingleton tracks persistent metrics and shares data between scenes.
  • Observer: Implemented via Godot signals. Events that don't require per-frame checking (state switches, hitbox/hurtbox events) are handled on signal emission.
  • Factory Pattern: Represented by spawners that instantiate enemies and add them as children of the current scene until destroyed.

How Certain Features are Implemented / Algorithms

Enemy States

When idle, enemies slowly walk toward the player's global position (from PlayerSingleton). Each enemy has a defined "chasing area". Once the player enters it, the enemy is triggered into a chasing state with faster movement and a different animation. If the player enters the "attacking area", the enemy switches to attacking state and deals a certain amount of damage every second. On death, a death animation plays; after the animation finishes the enemy node is safely removed from the scene.

Collisions

Separate layers and masks are used for each collision area so they don't interfere. A layer represents the "realm" the area exists in; a mask represents which realms it checks for. Player and enemy hitboxes are activated only during the attacking state and deactivated on exit.

Parallax Background

Layered backgrounds create a parallax effect. When a layer reaches a defined point it is duplicated across the X axis so it scrolls indefinitely. Each layer uses a different scale factor so it moves at a different speed. A separate "smog" layer has transparency and moves faster to appear closer to the camera.

Player States

Input detection is isolated in controller logic. On input, the controller switches to the appropriate player state which plays the corresponding animations.

Enemy Spawners

On each level, there are enemy spawners, that are continuously spawning enemies depending on the customizable timer interval. They are using a function that randomizes which enemy will be spawned based on provided weight.

Item dropping

In a similar fashion, both, enemies and destroyed spawners can drop an item, also randomized based on the weight 

Credits

Developed by: Petar Bratic for TwoDesperados — 2025 Game Jam
Tools used: Godot Engine 4.4 (GDScript), Aseprite
Assets: All assets used are free assets found on itch.io
Soundtrack: All songs used are from the YouTube channel @8BitUniverse

Feedback

If you found any bugs, have suggestions, or want to share your thoughts, please leave a comment, create an issue on GitHub, or reach out on Discord. :)

Published 5 days ago
StatusReleased
PlatformsHTML5, Windows, Linux
Authorneuro_dev_ergent
GenreAction, Adventure
Made withGodot
Tags2D, Pixel Art, Retro

Download

Download
rule-of-three-win.zip 67 MB
Download
rule-of-three-linux.zip 61 MB

Install instructions

Windows:
1. Download the windows version of .zip file
2. Right click; Extract all
3. Open the extracted folder and run .exe file

Linux:
1. Download the Linux version of .zip file
2. unzip rule-of-three-linux.zip
3. Inside of that directory, run: chmod +x 'Rule of Threes.x86_64'
4. Run the game with: ./`Rule of Threes.x86_64'

Leave a comment

Log in with itch.io to leave a comment.