BSc2a Dev Log 4 – 09/02/2024


Enemy permutations

To finalise the enemy spawner actor, I added a random variable that decides between 1 and 3 enemies to spawn and a further permutation variable that generates one random position based on every possible enemy combination within the 4 lanes.

A more efficient way to set up this code would be to store every permutation per enemy count in an array, or text file contained with the game, and read from this based on the random integer generation. This would also allow for fluidity between different numbers of lanes.

Enemy timer

Once the random enemy spawning was finalised, I added the timer to spawn enemies in based on the rate specified by the multiplier variable. The multiplier constantly increases the enemy spawn rate based on the player’s score – effectively increasing based on how long they survive and how many enemies they defeat.

Looping based on a constantly changing variable only worked by setting up the timer inside the tick function and using the CanSpawn variable to check whether the function is still being executed or not.

Spawn rate = 1 frame – player score / 100. This is a temporary equation I used for testing that rapidly increases the enemy spawn rate until reaching its maximum value at 80 score. This equation could easily be manipulated to scale faster or slower for difficulty selection.


Leave a Reply

Your email address will not be published. Required fields are marked *