added cool animation to springs

This commit is contained in:
zoe 2021-10-18 13:25:09 +02:00
parent 7b67b3aef6
commit a88727b2d8
13 changed files with 267 additions and 47 deletions

View file

@ -3,7 +3,13 @@ extends StaticBody2D
func _ready() -> void:
if GameStats.powerup_active:
queue_free()
else: GameStats.powerup_active = true
else:
GameStats.powerup_active = true
# spawn animation
var main = get_tree().current_scene
var Anim = preload("res://Pegs/Yellow/Powerups/Spawn/FromBottom.tscn")
var anim = Anim.instance()
main.add_child(anim)
position = Vector2(0, 184)
# spawn all the springs with some delays
@ -13,16 +19,17 @@ func _ready() -> void:
counter += 1
child.animate_spawn(rand_range(1, counter))
func explode():
queue_free()
Engine.time_scale = 1
GameStats.powerup_active = false
func make_green():
for child in get_children():
if child.has_method("animate_hit"):
child.animate_hit()
$DeathTimer.start()
GameStats.powerup_active = false
var SFX = preload("res://Pegs/Yellow/Powerups/Spring/SpringSFX.tscn")
var main = get_tree().current_scene