Hello, I made an spawner entity but I dont know how to randomly spawn enemies over time, I also would like to increase the frecuency of the spawning as the player does more points.
Any Ideas?
1 decade ago
by drhayes
Instantiate a timer in your init function with a random value in it. In the update function of your entity, see if the timer has expired; if it has, spawn a creature. When you spawn a creature, set the timer to a random value again. It's a pretty basic spawner, but it'll get you going.
If you want the spawn rate to increase as the player gets more points, then you want player points to be inversely proportional to spawn time. You probably want a function that'll smoothly approach some limit, something like
1/x. Player score is the x and spawn rate is the y, in this case.
Thanks for the reply, thats a nice solution I will try it once I get home.
Page 1 of 1
« first
« previous
next ›
last »