Dancing animations, some glitch fixed
This commit is contained in:
38
gymkhana/rooms/turno_cocina/creditos/DancingAnimator.gd
Normal file
38
gymkhana/rooms/turno_cocina/creditos/DancingAnimator.gd
Normal file
@@ -0,0 +1,38 @@
|
||||
extends AnimatedSprite
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
var current_index = 0
|
||||
var current_animation = "idle"
|
||||
var num_animations = 3
|
||||
var animations = ["donkey", "disco", "pulp"]
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
escoria.game_scene.clear_tooltip()
|
||||
if(escoria.globals_manager.get_global("turno_cocina_credits_dancers_visible")):
|
||||
self.visible = true
|
||||
|
||||
if !escoria.globals_manager.get_global("turno_cocina_credits_dancing"):
|
||||
return
|
||||
if($Timer.is_stopped()):
|
||||
$Timer.start()
|
||||
current_animation = animations[current_index]
|
||||
if self.animation != current_animation:
|
||||
play(current_animation)
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_Timer_timeout():
|
||||
current_index += 1
|
||||
if current_index == num_animations:
|
||||
current_index = 0
|
||||
Reference in New Issue
Block a user