2D action boss and enemy programmer

Duke vs The Gang

image coming soon key art

ABOUT THIS PROJECT

A 2D action game shipped on Steam by a 30-person student team.

DGA's flagship project: A 2D action game developed by a 30-person team at Cornell's Development in Games Association and released on Steam. I worked on the enemies: the two boss encounters players spend the most time learning, and the minions that fill the space between them.

The Pig Rider gets a second phase

The Pig Rider (Drover in the code) picks between targeting, charging, marking and bouncing off the walls. His second phase is a SetPhase override: at half health he flips to enraged, the bounce chance jumps to a designer-set enragedBounceChance, the number of ricochets is drawn between serialized min and max bounces, and he turns invulnerable. The phase guard was checking the wrong phase index and never fired, which was the first bug I fixed on him. Wall detection moved from tag comparisons to a LayerMask, and a bounce now zeroes his velocity before applying the impulse so he separates cleanly from the wall instead of jittering along it.

image coming soon the Pig Rider enraged

The pigs are how you break his shield

Invulnerability lives on the Boss base class, where TakeDamage returns early while the flag is set, so it works for any boss. Breaking it is a loop through the pigs: a whip hit knocks a pig back along the whip direction and sets that as its charge direction, and a pig that reaches the marked Pig Rider within a serialized hit distance stuns itself, clears his invulnerability and fires a Cinemachine impulse for the screen shake. A shield object toggles on the flag so the player can read the state, and the smoke trail flips its offset and scale with the sprite so it trails behind whichever way he is facing.

image coming soon a pig breaking the shield

Pig minion AI

The pigs run their own state machine of patrol, charge, return and stunned. Patrol moves them across a set distance and elevation on a randomized start delay drawn between a min and max, which stops a group of them from sliding in lockstep and reading as one object. Charging commits to a target position, returning uses an arrival threshold rather than an exact position check so a pig never jitters trying to land on a float, and they remember their starting point so they have somewhere to go back to. They also carry their own stun timing and whip knockback force.

image coming soon pig swarm

Granny runs on a six-state machine

Granny.cs is an enum-driven state machine over Idle, Invincible, HoldingContract, ContractDropped, Scavenge and Returning, dispatched from a switch in Update against a single stateTimer. Every transition sets its own duration and zeroes her velocity before handing over, so a state never inherits leftover movement. Her coin, contract-coin and double-contract-coin attacks are BulletPattern assets on serialized fields, and every duration in the fight is a [SerializeField], because the designers retuned this fight repeatedly and none of it should have needed me in the room.

image coming soon Granny mid-fight

Contracts are the real health bar

She fights while holding contracts that spawn inside a designer-authored list of bounds, and hitting her does nothing: destroying the contracts is what removes her health. Drop one and she leaves her attack pattern to go and get it, running a nearest-contract search over the dropped ones, walking to it, then returning to her start point before resuming. The double-contract case gets its own lock flag, because two contracts resolving in the same frame was the bug behind most of the fight breaking, either by taking double health or by leaving a phantom contract on the board.

image coming soon Granny contracts