Shoot ‘Em Up -Project

For this project, i wanted to create a Shoot ’em up -game from Top Down perspective.

First I created basic Player -character from capsule mesh, and Enemy -character from Cylinder Mesh. Then i added script that allows Player to move, and look at the position of the cursor.MoveInputScript


Enemies use Nav Mesh Agent to move. They consider Player as Target, and tries to follow it to it’s location.

EnemyNavAgent


Now we have a Player character that can move and look around,
and an Enemy character, that will follow the Player character.

Enemy pathfind
The red line indicates where the mouse cursor is located from cameras perspective.
This information might come in handy later on.


Next i created Gun that Instantiates projectiles (bullets) when left mouse-button is pressed.
Every projectile contains variable named Damage, that it inflicts to targets Health upon hit.
Projectiles destroy themselves when they collide with something, but the also have a lifetime of 3 seconds, after which it will destroy itself. This is to prevent clogging up the memory.

ShootingScript gun shooting


 

I also made some shooting effects.GunEffectsScriptNow when the gun is fired, it instantiates 1 projectile, 1 empty shell and 1 muzzle flash effect.
gun effectenemies pathfind
Muzzle flash effect is made of Particle System.
It contains quick flash of light, few sprite-based sparks and a puff of smoke.
Effect fades out in about 1,5 seconds, after which it will destroy itself.

Also added Spotlight component to Player, to serve as flashlight.

I also implemented 2 Virtual Joysticks for mobile controlling.
I used CN Controls -package from Asset Store, since it would take quite a while to write your own multiplatform Joystick -scripts, and there’s no need to reinvent the wheel, so to speak..


 

Next i added script to visually show Health bars.

It’s made of 3 separate layers; Black bar as background/borders, Red represent character’s maximum Health, and Green is current Health. Green bar is scaled based on current Health;
Full health means scale 1, zero health means scale 0. Anything between is interpolated using Mathf.clamp().
Healthbar is updated only when character takes damage, instead of constantly updating.
SetHealthBarenemy health


When Enemy’s Health drops below zero, Enemy gameobject is destroyed.
At the same time it Instantiates a Particle System.
This Particle System contains 15-20 small cubes that spurts to forward direction.
Cubes have total lifetime of 3 seconds. They also dynamically react to environments, and shrink over time, before destroying itself.

enemy deathparticlesenemy deathparticles2
Particle System’s forward direction is set to opposite of the direction that the hit came from.
This makes the particles to spurt into right direction, based on where the Enemy was hit.


 

I then added 2 sphere -shapes to the Particle System. They emit from the location that the eyes used to be, and spurt into random directions.

enemy deathparticles eyesenemt eyepops

Now it looks like the Enemies eyes are popping out when body breaks into pieces.


 

I also gave Guns to some Enemies. It’s the same Gun that the Player has.
Enemies have 2 conditions for firing their guns;
-They need to be close enough to the Player (10 units, at the time)
-They need to have a clear line of sight.

Other Enemies don’t count as visual obstacles. Enemy’s Projectiles also hurt other Enemies.
These things can be tweaked later, depending on how well they suit the game.

Added few cel-shading materials and low poly environment objects for prototyping purposes.
Starting to look like a real game.

gameplay


TO BE CONTINUED

 

Leave a comment