Abheek Dhawan
4 years ago
6 changed files with 5 additions and 25 deletions
Binary file not shown.
@ -1,20 +0,0 @@ |
|||
extends Node2D |
|||
|
|||
var time = 0 |
|||
var asteroidObj = load("res://Objects/Asteroid.tscn") |
|||
var spawnTime |
|||
var deltaSpawnTime = 1 |
|||
|
|||
func _process(delta): |
|||
spawnTime = 500/get_viewport_rect().size.x * deltaSpawnTime |
|||
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() |
|||
add_child(asteroid) |
|||
asteroid.position.x = rand_range($Rocket.position.x - get_viewport_rect().size.x/2, $Rocket.position.x + get_viewport_rect().size.x/2) |
|||
asteroid.position.y = rand_range($Rocket.position.y - get_viewport_rect().size.y, $Rocket.position.y - 2 * get_viewport_rect().size.y) |
|||
asteroid.rotation = rand_range(0, 6.28) |
Loading…
Reference in new issue