forked from team-sg/hero-mark-2
23 lines
583 B
GDScript
23 lines
583 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_frames = time * 0.0166666666666667 # Time is converted from ms to frames @ 60fps
|
|
|
|
func _ready():
|
|
#Autostart animationplayer
|
|
anims.play("idle")
|
|
timer.set_wait_time(time_frames)
|
|
timer.start()
|
|
|
|
|
|
func _on_AnimationPlayer_animation_finished(anim_name):
|
|
#Return to idle after turn animation
|
|
if anim_name == "turn":
|
|
anims.play("idle")
|
|
timer.set_wait_time(time_frames)
|
|
|
|
|
|
func _on_Timer_timeout():
|
|
anims.play("turn")
|