Cannon App
A target-destruction artillery game on a clean weapon hierarchy. I built an abstract weapon base, rigidbody cannonballs that explode with OverlapSphere blasts, a splitting projectile, and regex-driven level flow across a three-level campaign.
Playable Open the WebGL tab to play it in your browser.
-
01
Architecture Abstract Weapon Base
Built an abstract
WeaponMonoBehaviour that owns the per-frame loop and declaresAim()andTryFire()as abstract steps, so a new weapon is a subclass overriding two methods instead of a rewritten update loop.Weapon.cs -
02
Aiming Clamped Mouse Aim
Programmed mouse aim that yaws the cannon base and pitches the barrel, each clamped to a tunable min / max so it can never over-rotate, with the cursor locked for mouselook.
CannonController.cs -
03
Projectiles Rigidbody Cannonball & Blast
Built cannonballs fired on an impulse with random spin that, on impact, freeze the body, play the explosion, and apply
AddExplosionForceto every rigidbody inside a layer-maskedPhysics.OverlapSphere- so a near miss still scatters the targets.CannonBall.cs -
04
Special Splitting Projectile
Subclassed a
SplitCannonBallthat counts down a timer in flight and forks into two balls angled left and right withQuaternion.AngleAxis, inheriting the base cannonball's impact and explosion behaviour.SplitCannonBall.cs -
05
Scoring Trigger-Based Targets
Wrote targets that report their own destruction when they fall into a water trigger layer and remove themselves, so the win condition is physics landing the targets in the sea rather than manual hit detection.
Target.cs -
06
Flow Level Discovery & Progression
Built a level controller that discovers how many
Level{n}scenes exist by running a regex over the build settings, tracks remaining targets, and advances to the next level or the end screen the moment a board is cleared.LevelController.cs