---
title: "Kirby Game"
year: "2020"
motto: "Video Game"
description: "Kirby video-game made as a birthday present."
stack: ["unity", "c-sharp"]
website: "https://lab.rolandoandrade.me/game-webgl/"
url: "https://rolandoandrade.me/projects/kirby-game/"
author: "Rolando Andrade"
---

# Kirby Game

> Video Game

Kirby video-game made as a birthday present.

Year: 2020. Stack: unity, c-sharp. Website: https://lab.rolandoandrade.me/game-webgl/

Repositories:

- [github](https://github.com/RolandoAndrade/KirbyGame)
- [gitlab](https://gitlab.com/RolandoAndrade/KirbyGame)

My friend has loved Kirby since she was a child. Kirby is the pink, round hero who swallows enemies and steals their powers. Her birthday was coming, and I wanted to give her something she could not buy. So I made her a Kirby game from scratch.

I could have bought merchandise or a gift card. Neither would show that I spent time making something just for her. A game would.

It became my first complete 2D platformer, a game where you run and jump across platforms. It has three levels, several abilities and a full animation system. I built it in Unity over a few weeks as a birthday surprise.

## Swallow enemies, steal powers

The game copies the feel of the classic Kirby games. You guide Kirby through side scrolling levels full of platforms, enemies and items to collect. His famous move is there. Kirby swallows objects and enemies, then uses their powers or spits them out as projectiles.

The three levels go from green meadows to a final challenge. Each one has its own layout, dangers and pace. Coins hidden around the levels reward exploring. A health bar gives you room for mistakes.

The game runs in the browser through WebGL, the technology that draws 3D and 2D graphics on a web page. There is nothing to download. You open the page and play.

## Building the game

### One state at a time

Kirby can stand, walk, run, jump, fly and eat. Each of these states has its own behavior, its own animation and its own rules for what comes next. That is a lot to manage without structure.

I used a state machine for the player. A state machine is a system where the character is always in exactly one state, and clear rules decide the next one. Each state is a separate component. It knows what it does and which states it can move to. The player controller asks the current state what to do. The state reads the input and returns the next state.

Each state stays simple this way. The jumping state only knows about jumping. The eating state only handles swallowing. There are no huge switch statements and no tangled conditions.

### Factories build the actions

Walking, running and flying work in similar ways, with different details. I did not want to copy the same code three times. So I used factories to create the actions.

A factory is one place that knows how to build each kind of action. The state machine asks for an action by type, and the factory returns the right one. A new ability needs a new factory method, and the old code stays untouched.

### Animations that match the moves

Kirby breathes while idle. He has cycles for walking and running, poses for jumping and falling, and puffed cheeks for flying. Every action has its own look.

Unity's Animator controller moves between these clips. Values like speed, whether Kirby is on the ground, and the current action drive the changes. The code updates these values every frame. The Animator blends the clips on its own.

The eating animation got extra care. Kirby opens his mouth wide, and particles suggest air being pulled in. When an enemy gets caught, his cheeks fill up. It is a small detail, but it makes the ability feel right.

### Keyboard and touch input

The game had to work in desktop and phone browsers. Desktop players use a keyboard. Phone players use a touch screen.

Unity's cross platform input system handles both. The code reads input through one shared interface. Behind it, key presses and touch gestures turn into the same actions. One codebase works everywhere.

### Three levels, rising difficulty

The first level teaches basic movement and swallowing. The second adds harder platforming. The third combines everything into a final challenge.

Each level is a Unity scene. I placed every platform, enemy and trigger by hand. When Kirby reaches certain points, the next scene loads. The game saves progress, so you can continue where you left off.

### Short cinematic moments

Short scenes between sections make a game feel more finished. I added simple cinematics with camera moves, character animations and text captions to tell the story.

They play on their own at key moments. Normal input pauses while they run. When they end, the player gets control back.

## Where it fought back

The jump physics took many tries. Jump height, gravity and control in the air all affect each other. Too floaty and the game feels loose. Too heavy and Kirby stops feeling like Kirby.

Flying made it harder. Kirby can puff up and float against gravity. The switch between ground physics and flight physics had to be smooth. I change the gravity scale when he starts flying and restore it when he lands.

Animation timing needed tuning too. The animation has to match the movement speed. If Kirby moves faster than his legs, he looks like he is sliding. Matching the two took many test runs.

## A birthday does not move

A gift has a hard deadline. The game had to be ready on her birthday, finished or not. That forced me to choose. Core mechanics came first, polish only if time allowed, and features that could not finish got cut.

State machines became my default pattern for characters with complex behavior. The clarity is worth the setup time. Every character project I have built since starts with one.

Personal projects can mean more than paid work. My friend still plays this game years later. That matters more to me than any performance review.

[Book a call with Rolando](https://rolandoandrade.me/pricing/)
