make the steam more fair

This commit is contained in:
Haze Weathers 2023-03-03 20:28:10 -05:00
parent 8a210d1da1
commit d518dce44d
2 changed files with 162 additions and 8 deletions

View file

@ -6,23 +6,30 @@ export var active = false
onready var particles = $SteamParticles
onready var collision_shape = $Hitbox/CollisionShape2D
onready var animation_player = $AnimationPlayer
var time = 0.0
func _ready():
if !active:
particles.emitting = false
collision_shape.disabled = true
func _physics_process(delta):
time += delta
if active && time >= on_time:
time -= on_time
active = false
collision_shape.disabled = true
particles.emitting = false
animation_player.play("turn_off")
elif !active && time >= off_time:
time -= off_time
active = true
collision_shape.disabled = false
particles.emitting = true
animation_player.play("turn_on")
func switch_action():
particles.emitting = false
collision_shape.disabled = true
get_tree().create_timer(particles.lifetime).connect("timeout", self, "queue_free")
animation_player.play("turn_off")
animation_player.connect("animation_finished", self, "_queue_free")
#stupidstupidstupidstupidarrrghhhwouldnotneedtodothisshitingodot4grumblegrumble
func _queue_free(_anim_name):
queue_free()