ld55/src3/Actor/actor_explode.gd

22 lines
477 B
GDScript
Raw Permalink Normal View History

2024-04-14 15:43:40 +00:00
extends ActorState
class_name ActorExplode
var time = 1
var timer = 0.0
var current_scale: Vector2
func _init(_actor):
super(_actor)
self.current_scale = actor.sprite().scale
func _process(delta):
self.actor.sprite().scale = Vector2(0.1, 0.1) * (sin(self.timer*delta*10000) + 1.0)/2.0 \
+ self.current_scale
self.current_scale += Vector2(1, 1) * delta * 0.2
if self.timer > self.time:
self.actor.set_state(null)
self.actor.queue_free()
self.timer += delta