← Back to projects

CrazyMoles

CrazyMoles is a memory-based whack-a-mole game with rhythm elements. Players must hit all 20 unique moles as they appear in time with the music, avoiding repeats, since previously hit moles reappear as puppet versions. Hitting a puppet three times ends the game, and failing to hit all moles before the song ends also results in a loss.

This is my first game made with Godot, so I’m by no means an expert. There are likely some mistakes in how I implemented certain systems, but I’m always learning and improving my approach.

__mobile Since you’re viewing this on a mobile device, I can’t provide a playable web demo here, but here is a full gameplay video showcasing all the main features. If you're interested in trying the game yourself, feel free to revisit this page from a desktop browser.

__pc Here is a full gameplay video, but you can also try it yourself as I made a web build just for this portfolio. Please note that minor audio looping issues may occur in the browser version, but these do not affect the gameplay experience.

Your browser does not support the canvas tag.

Implementation Details


Moles

Entity Architecture

Each mole in CrazyMoles is an instanced scene containing its sprites, particles, sounds, animation logic, and hit detection. Each instance maintains its own state, including position, speed, mole skin, and hit status.

At the end of the day, each mole is basically a group of sprites behind a mask, with some extra sprites layered in front and behind.

Hierarchy

Animation System

moles_show_process

Hit System

The hit system is an extension of the existing pop-up animation. When a mole is clicked, a series of conditional checks determines if the hit is valid. If so, the touched flag is activated, causing show_percent to decrease at a separate speed (touched_speed) for a linear downward movement.

No animation curves are applied in this case. Additionally, the mole’s sprite is swapped to its 'hit' version, and a particle effect and small shake are triggered to visually reinforce the impact.

moles_hit_process

Skin System

Each mole has a Sprite2D node containing an atlas with all mole designs arranged in a grid. Each row corresponds to a different mole, and each column represents a specific state: 0 = normal, 1 = puppet, 2 = hit.

When selecting which mole appears, the Animation properties of the Sprite2D node are used:

Moles Skins Moles Skins Animation


Public API and Usage

Moles provide a set of functions that let the rest of the game control their behavior. These functions allow external systems to show, hide, or manipulate moles without accessing their internal state directly.


Designing Rhythm Patterns

Designing the mole appearance patterns was one of the most challenging aspects of the project.
To determine the exact moments when moles should appear in sync with the music, I used Audacity’s label system:

audacity_workflow audacity_labels_exported

This approach ensured mole appearances matched the song's rhythm. However, designing the actual patterns, deciding which moles appear, their skins, and where they pop up, is still tricky, as editing labels in Audacity or the exported file is tedious and error-prone.

To simplify this, I created a small Python script that parses the labels into JSON and then back into a .txt format. This allows me to conveniently edit mole sequences without having to modify the Godot code when importing them.

You can download it here. It’s a simple, unpolished tool made to speed up editing mole sequences.

moles_json


Cursor Implementation

The game uses two cursors:

Cursor state is managed by cursor_controller, which checks the global game state (gameplay, pause, end menu, main menu) and selects the appropriate cursor and sprite. On desktop, the native Godot cursor system is used. On web, where cursor handling is unreliable, the controller bridges to JavaScript: cursor sprites are encoded in Base64 and assigned through a custom JS function.

cursor_code

Note: This project page is still a work in progress. More details and explanations about CrazyMoles will be added soon.