Now that we have reached the end at the 3rd and final level. Its just you, your ship, and a big bad Boss. Since we can’t have the boss just randomly sit there and let you take pot shots at them, it is time to create some Ai. In part 1, we will focus on setting the ground works which includes understanding a State machine and setting up a single state for movement.
What we will be needing for this setup is a brand new Script which will be the Boss Behavior script and a graphic that can represent itself…
You know what is even better than Tracking lasers or 360 projectiles? Mines that track your movement once you get into a certain distance then follow you until DOOM reaches either one off us. Yea that definitely sounds better! (sarcasm is not my greatest feature.)
What we will be needing this time is the Enemy script and of course an game object that is either the enemy or any other image that can represent itself as an enemy. In my case, I used mines.
We start off by creating an new private float variable to handle the detection area.
Since the scatter shot wasn’t enough to drive me insane… yet, lets create something more difficult! Homing projectiles! What we will be needing to accomplish this is an Enemy Script, and a new script (which I named “Targeting Bullet Behavior”) and of course a graphic that can represent a projectile.
So instead of doing a polygon this time, I went a little more complex and drew an orb. Yes orbs can be… actually I don’t know if they are scary but it sure looks painful hitting my ship.
Welcome to level 2 of our trauma inducing game, were we have to create a new enemy type so players won’t get bored. In this article, we are going to create an enemy that fires an 360 scatter shot! What we will be requiring this time would be, the Enemy script, a new Enemy bullet behavior script and some graphics that can be identified as projectiles.
For the graphics, I basically used a polygon… yup a polygon. Polygons can be scary! especially when they are pulsating.
Wouldn’t it be nice to have your current high score carry over to the next stage. Or even better yet, have your remaining Ammo count and After burner enery carry over? Well now you can! Thanks to a little script called “PlayerPrefs,” this allows the user to automatically save set variables upon leaving a scene and re-entering a new scene. PlayerPrefs are able to store 3 types of data, an integer, a string and a float.
For this article, we are going to be only using the Player Script, since that is where all the data from your current score…
A mini article on how to show min/max ammo capacity to players know what to expect. What you will be needing is just the UI manager script.
In the UI script which handles everything with UI elements. We locate the Update Ammo method which controls the adding or subtracting of ammos.
Ok ok, I know we have been giving the player some nice and “niffy” power ups and it is time to balance out the odds. We are going to add a random generated script that allows some spawned enemies to have shields.
What we need to accomplish this time is just the Enemy Script, and an graphic that identifies as a shields/barrier.
This time around we are going to make things easier for ourselves by reusing the shield asset from the player.
Creating a secondary fire Ammo refill is very similar to the regular ammo pick up. You will need to have the Player Script, the PowerUp script and the Spawn Manager script. Along with some graphics representing the ammo container.
I just basically taken a basic container that I added some animation to, along with the text “Special” to let the player know that this ammo will be for the special weaponry. I attached a Box Collider and Rigidbody2D to the component along with the PowerUp script.
In the player script, since we have already created the initial method class for…
Tired of just shooting your own tiny little lasers? Sad that your puny laser keeps missing the target? Frustrated that you can’t play your own creation because you suck at this game? Then it is time to create a secondary weapon that can delete everything in front of our player! This secondary fire will work independently from the main fire, and will have a limited ammo of 3.
Since this is an independent firing systems, I will be mapping the firing key to the keycode “E”. So when “E” is pressed it will instantiate a giant laser graphic with a…
Now that we have our Ammo counter completed, its time to work on reloading and we can do this by picking up an Ammo container!
Similar to how we have implemented all the other power ups and special abilities, the ammo pick up will be basically the same process. We are going to be requiring the Spawn Manager script and Power UP script.
Since we have already written most of the required scripting from part 1, all we have to do is create an new switch case in the power up script. This is also where we are going to…
A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.