Journal 139 — Unity Project Development Part 1–2.5D Shooter
Objective: To develop a complete 2.5D Shooter
In this new series of articles, I am developing a 2.5D sidescrolling shooter, starting with a basic set of aircraft and environment assets.
The game will include the following:
- wave system for regular enemies, a mid boss, and final boss fight
- weapon power ups
- animations and sound effects
My goals are to first get the basic movement, weapons, and enemies working along with some basic animations. Then I will revisit all the areas of the game and refine the player movement, add sound effects, music, post processing effects, and UI. I plan to release this for Windows PC and Android.
Movement
To start, I am going to work on the basic movement. I’m using the new Unity Input System.
I will start with creating a new Input Actions asset called “PlayerActions”. I will create a 2D Vector Action for the WASD movement and Button Action for the regular attack and special attack.
After creating these actions and selecting “Save Asset”, I selected “Generate C# Class” in the Inspector and select “Apply”.
On the Player game object, I will use the built-in Character Controller component to handle the movement.
In the Player C# script, I will add a reference to the Input Action and Character Controller. Using the new Input system, I can read the Vector2 value of keyboard movement I previously set up. To move with Character Controller, I use Controller.Move().
Here are the results.
Movement Limit
I want to restrict the player so it cannot move off screen. I can simply add some 3D cubes and turn off the renderer, and only use the box colliders.
Animation
Next, I will add a basic animation for the helicopter blades by selecting the rotor objects and changing the y-axis and z-axis rotation values respectively and recording several keyframes.
Here are the results.
I’ll add some additional animations later to tilt the helicopter slightly on movement and show a thruster animation.
Weapons
I will make a basic weapon projectile based on a prefab. I will add a collider and Rigid Body and script to move the projectile to the right. I will also add a collider and check the name of the enemy craft that I hit, and I will destroy the projectile after it leaves the game view.
I will need to instantiate the bullets from near the nose of the player craft, so I will add an empty object there with a script to instantiate the projectiles.
Back in the Player script, I will update the button trigger action to call the fire function.
Now we can check the results.
Thank you for your time!
In the next series of updates, I will add the enemy movement and attack using a wave system.