When we want to set up some simple repetitive motions, as Coders, we may automatically start to work out a new script. But this is not always the best solution. Unity has a powerfully useful Animation system that will let us create simple or complex movements.
For this article we will be creating an Animation that makes this Satelite model swing back and forth between 15° and -15° on the Y axis.
The goal for this article is to get Shields on our Enemy units. And while it may be a good option later to add Shields permanently to the units for a higher Difficulty setting, right now, we will set it up so that each unit will get a single shot Shield at random when they Spawn or Respawn. And we will increase those odds based on the current wave.
If you haven’t been following along, the Shield effect is from our article, Raise the Shields. To give it a different look, we changed the Color and rotated the Shield GameObject…
No matter if you are planning on sharing your Articles on Twitter, LinkedIn or Facebook, a GIF for a thumbnail will draw more attention than a static Image. So, I am going to go over some of the things I do to get good GIFs on my Articles to share.
Firstly, I use ShareX to capture my GIFs as well as take screenshots. It is a simple Taskbar Application that can be set up with hotkeys to Record GIFs or take Screenshots with ease and store them in presorted folders.
In my last Article, We looked at how to make a proximity space mine. Now we need to look at how we get those mines into space, The Mine Layer itself.
This Enemy will borrow most of it’s code from the Basic Enemy type and will show similar behavior, to a point. Once it has detected that it is behind the Player’s position, It will lay (disperse) between 1 and 5 mines on either side of it’s own path. The is also some delay between when it Knows it can deploy and when it does, otherwise we may end up…
It’s time to look at expending our selection of Enemies to deal with the Player.
For this enemy, we will be borrowing some ideas from the tracking Missile.
This enemy will start out as primarily a copy of our basic Enemy type. We will talk about Abstract Classes another time. For now, We will make a new script and copy the body of our Basic Enemy Class into the new script.
Let’s take a look at the changes we will need to make to get the behavior we are looking for.
In the heat of the moment of battle, your player runs out of ammo and the nearest Powerup is on the other side of a line of missiles. Luckily, they have been saving the last the magnet charge for just this moment.
The ability to draw power ups to them is something the Players will learn to treasure. How to effect so many things at once may seem like at daunting task as a coder. But we can use C#’s Delegate and Event system to achieve our goal.
So yesterday, We made a tracking Missile. That’s good but how do we actually set a target for our new Missile. When it is being used by the Enemies against the Player it is simple. There is only the one Player, target them, but there are many targets for the Player to choose from. So, Let’s target the closest enemy…
When thinking about ways to increase the challenge to your game or how to give your Player and advantage, Heat- Seeking Missiles are often near the top of the list of ideas. But how do you go about making them in system that doesn’t have ‘heat’.
In our game, we decided that a Wave system would be a good way to give the Player a since of progression.
So instead of the endless onslaught of enemies that we have had up to this point, the Player will experience clusters of enemies.
Now let’s see how we can setup a simple Wave system that is based on an amount of enemies to be spawned. Later we we can modify the system to allow for Boss fights and possibly even Mini Boss fights.
A Unity Developer with a fondness for Fantasy games and the challenge of pushing boundaries.