From 9a5672fb00df97cf794eb96c5eab2b51578ca2d1 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Thu, 29 Oct 2020 21:56:25 -0500 Subject: [PATCH] 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. --- Scripts/AsteroidSpawn.gd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Scripts/AsteroidSpawn.gd b/Scripts/AsteroidSpawn.gd index 2c64b10..870533f 100644 --- a/Scripts/AsteroidSpawn.gd +++ b/Scripts/AsteroidSpawn.gd @@ -7,10 +7,13 @@ 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 - deltaSpawnTime *= 0.995 + if spawnTime > 300/get_viewport_rect().size.x: + deltaSpawnTime *= 0.995 if has_node("Rocket"): var asteroid = asteroidObj.instance() add_child(asteroid)