25 lines
599 B
GDScript
25 lines
599 B
GDScript
extends Node2D
|
|
onready var anims = $AnimationPlayer
|
|
onready var timer = $Timer
|
|
export var time:float = 60
|
|
export(int, "Wood", "Yellow") var color
|
|
onready var time_ms = time * 0.0166666666666667 # Time is converted from frames @ 60fps to ms
|
|
|
|
func _ready():
|
|
#Autostart animationplayer
|
|
anims.play("idle")
|
|
timer.start(time_ms)
|
|
|
|
func _physics_process(delta):
|
|
pass
|
|
#Debug.print(timer.)
|
|
|
|
func _on_AnimationPlayer_animation_finished(anim_name):
|
|
#Return to idle after turn animation
|
|
if anim_name == "turn":
|
|
anims.play("idle")
|
|
timer.start(time_ms)
|
|
|
|
|
|
func _on_Timer_timeout():
|
|
anims.play("turn")
|