Enemies & Spawning
For the enemies in Big Sword I want to have a few types but I intend to reuse the same sprite but recolored. The enemies will be different color depending on how much HP they have and how fast they move. For now I've been reusing my stand-in player sprite but recolored:
Isn't he cute? This is the harder difficulty guy:
I went ahead and made prefabs for each kind, easy, medium and hard. Then I created spawner object on each of the four cardinals of the map that spawns an enemy roughly every 3 seconds. I wasn't sure whether to make the spawners independently count from each other but I figured that would feel better if they were offset from each other rather than coming in all at the same time.
Now the fun part is sorting out how and when to spawn the more difficult enemies. I knew that over time I wanted enemies to get more progressively difficult, and I also knew that the game would always last 3 minutes, so this seemed the time to figure out how to weight the probability of each enemy spawning and then change those weights as time passed. I decided to map out how the weights would increase and after some deliberating came up with the following table:
As time increases so do the weights for both the medium enemy spawning and the hard one. I thought 30 second increments was enough as it gives the player time to get used to the stage of difficulty and then move onto the next. By the end I want medium enemies to be the most common with hard ones spawning pretty frequently. I can simply grab the current time from the Timer object which tracks the game time.
To implement this in code I used a method where you get the sum of the weights and then pick a random number within that sum, then you subtract from the sum until you get to the number, and the closest weight is the chosen one. Then I just simply had to make it so that as time passed the weights were adjusted to whatever values I wanted.
For the enemy AI I took the Seek script from the practicals as this is all I need for the enemies to do and I can easily adjust their speed.
Big Sword
Status | In development |
Author | jofbob |
More posts
- Finished Game ProjectMay 30, 2021
- Melee combatMay 30, 2021
- UI & sound stuffMay 30, 2021
- The player & the swordMay 30, 2021
- The basic levelMay 30, 2021
- Game ConceptApr 15, 2021
Leave a comment
Log in with itch.io to leave a comment.