Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Same Enemy Spawning

Robert Dionian

12/15/2023

Problem: Every time you would initiate combat the same enemy would spawn, If you triggered combat with the boss enemy every enemy you encountered after would be considered the boss. This was happening just because of the lack of different enemy types at the time, the boss was spawning over again because there is a bool on the boss character to check if the enemy that is being encountered is the boss, that way the correct enemy could be spawned. After encountering the boss and setting the IsBoss bool to true I had forgot to set it back to false, therefore causing every enemy encountered afterward to be treated as the boss enemy.

Solution: The solution to the boss was of course a simple fix to just set the bool to back to false. The solution for the same enemy being spawned was also simple enough. I just had to make more enemy types, for spawning the enemies so the same one is not encountered in the combat level every time I stored the references to the different enemy classes in an array. When an enemy is spawned in the combat level it is spawned from a random index in the array of enemy class references.

Support this post

Did you like this post? Tell us