Browse Source

Add cap for asteroid spawn delay

Added a minimum amount of time between spawning asteroids. Don't know
how well it'll hold up in plays, but it seems like it should be a good
number.
master
Abheek Dhawan 4 years ago
parent
commit
9a5672fb00
  1. 3
      Scripts/AsteroidSpawn.gd

3
Scripts/AsteroidSpawn.gd

@ -7,9 +7,12 @@ var deltaSpawnTime = 1
func _process(delta):
spawnTime = 500/get_viewport_rect().size.x * deltaSpawnTime
print(spawnTime)
print(get_viewport_rect().size.x)
time += delta
if time > spawnTime:
time = 0
if spawnTime > 300/get_viewport_rect().size.x:
deltaSpawnTime *= 0.995
if has_node("Rocket"):
var asteroid = asteroidObj.instance()

Loading…
Cancel
Save