Conquering Ciros Week 8: Vampire Survivor-ing and Pooling Enemies

Published March 03, 2024
Advertisement

This Week's Work:

I had a couple different tasks this week, and managed to get both of them done. I wasn't sure how long each of them was going to take, so we allocated an extra week to pooling if necessary, but it should be fully functional now. The easier task was improving the circle spawning to make it feel more dynamic and less glitchy. There was an issue where the circle enemies didn't despawn, so when they went offscreen they would stay stationary and look very out of place. They also didn't move at all while in the circle, so I added a very slow homing effect to the circle enemies so that they move towards the player. The mechanics are very similar to the Flowers from Vampire Survivors now:

Vampire Survivors' circle-style wave
The new circle-spawning with despawning and homing

It was a matter of just changing a few lines (setting homing to true and tweaking the speed a little):

Pooling was much harder of a task. Fortunately, we're already pooling things like damage numbers and experience, so we have some boilerplate to copy and paste. I was able to just add the enemy prefab to the list of poolable objects, and then create a list of the objects. However, we have three main enemy types at the moment, so I decided to make a separate list for each enemy type as opposed to putting them all in one list and then trying to find the proper type within the list.

I had to change the Enemy death function to disable the object instead of destroy it, which was easy (I didn't pool the mini-bosses or bosses since there aren't very many of them on screen at a time):

The hard part was adjusting the EnemySpawner functions, since each type of spawning (circle, line, single, etc) needed different changes. Here's what the new CircleSpawning function looks like:

A lot of the things like setting the position and the parent were managed in the old Instantiate call, but we have to do them separately now since we're just enabling a certain object. I also had to add this switch statement in order to tell which type of enemy we needed to spawn. It used to just be a matter of checking the current enemy type, but now we have to use that and choose the correct list accordingly.

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement