renamed turning platform
This commit is contained in:
parent
629bc75fbb
commit
139b862a47
11 changed files with 37 additions and 27 deletions
33
objects/environment/turniwood/turning_platform.gd
Normal file
33
objects/environment/turniwood/turning_platform.gd
Normal file
|
@ -0,0 +1,33 @@
|
|||
extends Node2D
|
||||
onready var anims = $AnimationPlayer
|
||||
onready var flip_timer = $FlipTimer
|
||||
onready var delay_timer = $DelayTimer
|
||||
export var time:float = 60
|
||||
export var delay = 0.0
|
||||
export(int, "Wood", "Yellow") var color
|
||||
onready var time_ms = time * 0.0166666666666667 # Time is converted from frames @ 60fps to ms
|
||||
|
||||
func _ready():
|
||||
#Auto start if delay variable is zero
|
||||
if delay == 0.0:
|
||||
anims.play("idle")
|
||||
flip_timer.start(time_ms)
|
||||
else:
|
||||
delay_timer.start(delay)
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
#Return to idle after turn animation
|
||||
if anim_name == "turn":
|
||||
anims.play("idle")
|
||||
flip_timer.start(time_ms)
|
||||
|
||||
func _physics_process(delta):
|
||||
Debug.print(delay_timer.get_time_left())
|
||||
|
||||
func _on_FlipTimer_timeout():
|
||||
anims.play("turn")
|
||||
|
||||
|
||||
func _on_DelayTimer_timeout():
|
||||
anims.play("idle")
|
||||
flip_timer.start(time_ms)
|
Loading…
Add table
Add a link
Reference in a new issue