guys can someone help me find a solution?
I have a group of enemies and each of them has been assigned a danger value.
example:
enemy 1 - value 1
enemy2 - value 2
enemy3 - value 3
I would like the enemies to be created by calculating the danger value that increases with each wave.
example:
if the danger value is equal to 5 - create 2 enemy2 and 1 enemy1 or 1 enemy3 and 1 enemy2
if the danger value is 10 - create 5 enemy2 or 2 enemy3 1enemy2 2enemy1
I hope I was clear on what I want
I attach screens of current events and folder with current project.
I remember watching a tutorial video about variables in GD and came across this vid. He uses waves as an example to explain variables similar to you on your creation.
I do remember him explaining and showing how to add enemies in waves using variables.
The key is the picking of the enemy. This is rough and might need tweaking.
Variables.
Level =0
Max =1
Remaining =0
EnemyNumber=0
(let’s say the enemies were enemy1, enemy2 and so on and in a group named EnemyGroup)
Example start of wave
Level +1
RemainingEnemies=level (or some other formula)
MaxEnemy = min(MaxEnemy+1, highest enemy number)
Start spawn timer
FYI, min() takes the minimal number.
min(3,10) would return 3
min(3,1) would return 1
Using min() here prevents the MaxMaxEnemy from being higher the maximum enemy.
You could either create a wave list using an array or pick an enemy each time the timer elapses
Timer >3
RemainingEnemies > 0
Resart timer
Set enemyNumber = RandomInRange(min(trunc (MaxEnemy) , RemainingEnemies ))
Add object by name from EnemyGroup
The enemy name would be
“Enemy” + ToString(number)
Remaining - enemyNumber
Using MaxEnemy would allow you to gradually increase the maximum enemy. It’s up to you.
Either after the last enemy is killed (number in scene is 0 and remaining is 0) or a time limit then the next wave would begin.
My concept choose a number between 1 and either the max enemy or the number of enemies left in the wave.