Question

In a game that I am making, the moment the game scene initializes, a random enemy will be chosen out of a list. Then, it will run a method that finds the current level. Then, it will find the number of chosen sprites required.

Each time all the enemies are killed, it will run through this process again, choosing another type of enemy, but this time the amount of enemies will have increased.

The problem is that I can't just add on a certain value to the amount of enemies to be created, as there are many different types of enemies, and they all work in different way, and therefore, some are harder to kill than others. What I need is a process that once it has selected the type of enemy that you are going to fight, it finds out the level, and then finds out the amount of that type of enemies it should create by using some data that I have input.

Example

Zombie is the type of enemy that has been chosen. The level number is 5. It then finds out how many zombies it should create for level 5 in a list of data.

(Level 3 = 5 zombies),(Level 4 = 6 zombies),(Level 5 = 10 zombies)

What is the best way to do this. I cannot think of a way. Thanks in advance.

Was it helpful?

Solution

I assume by level you mean your player level? As in an Role playing game?

You could assign a value to each enemy relative to how difficult they are to kill. If you do that then it becomes a matter of calculating how many enemies add up to your player level.

So if a Zombie is difficulty 0.5f then for each player level you would need to add 2 zombies. You should add some randomness to this so that it's not that obvious that you are doing it.

This would allow you to combine different enemy types as well.

OTHER TIPS

Couldn't you have a difficulty variable for each type of enemy and just use an equation with the level to turn that number into the amount of enemies? Such as:

current_level / enemy_difficulty;

And obviously tweak the equation to get the numbers you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top