ZombieHitman – Top-Down Shooter
The third game I made for my course was a top-down shooter genre prototype. For this Prototype, I used kenney.nl to get some assets to form the game with.
When looking through the assets for what to use, I saw a hitman character that I wanted to use for the game, and I paired it with the zombie model as enemies. I also added some crates and stones as defence against zombies. all the assets I used in the pack are below:
When I added these to the scene, I gave the player and enemy RigidBody components, which I froze their rotation with, and circle colliders while I gave the crates box colliders and the stones polygon colliders to fit their shape better.
When it came to coding I first worked on the player’s Movement in the script scr_Player_Movement, which controls which way the character is looking, and how it moves around the scene
In this script, the mouse cursor is followed, which is used to point towards where the character will turn to look. The line ‘Vector2 lookDir = mousePos – rb.position is used to determine where to look as it checks where the mouse is in relation to the player and determines an angle from there which sets the rotation to the correct angle.
Scr_PlayerShooting is also attached to the player and it controls how the player shoots their gun.
This script waits for the left mouse click to be pressed, and activates the shoot function. The shoot function creates a bullet, fetches the RigidBody component, and applies a force to the bullet to shoot it forward wherever the player is looking.
The next script is scr_Bullet which tells the bullet what to do when an enemy is hit.
This script detects when the bullet hits an enemy by using the colliders attached to each object. If it hits something tagged as an enemy, then it will destroy the bullet and the enemy, and spawn a new enemy somewhere on the map randomly using the Random.Range function I learned from the space invaders prototype.
There is one last script that is used, and it is scr_EnemyMovement.
The script locates where the player is in the scene, and gets the enemy to look in their direction and move forward, very much like the player movement. Once the enemy collides with the player, it restarts the scene, which I learned how to do in the space invaders prototype, and you die.
Overall, I think that the game came out well, but it feels a bit dull, and therefore I think could go back sometime and add more to it. I think having more variety in enemy types, and different powerups would make it much more enjoyable. I would also implement a scoring system to give meaning to killing enemies to get a higher score