Added animation to help anticipate turning block turning

This commit is contained in:
pennyrigate 2023-01-23 00:19:54 -05:00
parent 56e56a5cff
commit 3a8e9b757c
4 changed files with 48 additions and 14 deletions

View file

@ -3,20 +3,22 @@ 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
onready var time_ms = time * 0.0166666666666667 # Time is converted from frames @ 60fps to ms
func _ready():
#Autostart animationplayer
anims.play("idle")
timer.set_wait_time(time_frames)
timer.start()
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.set_wait_time(time_frames)
timer.start(time_ms)
func _on_Timer_timeout():

View file

@ -49,8 +49,8 @@ tracks/2/keys = {
[sub_resource type="Animation" id=3]
resource_name = "turn"
length = 0.5
step = 0.125
length = 0.9
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("StaticBody2D/CollisionShape2D:disabled")
tracks/0/interp = 1
@ -58,7 +58,7 @@ tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.125, 0.5 ),
"times": PoolRealArray( 0.4, 0.55, 0.9 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 1,
"values": [ false, true, false ]
@ -70,7 +70,7 @@ tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.125, 0.25, 0.375, 0.5 ),
"times": PoolRealArray( 0.4, 0.55, 0.65, 0.8, 0.9 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 8, 8 ), Rect2( 8, 0, 8, 8 ), Rect2( 0, 0, 8, 8 ), Rect2( 8, 0, 8, 8 ), Rect2( 0, 0, 8, 8 ) ]
@ -82,11 +82,23 @@ tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.125, 0.25, 0.375, 0.5 ),
"times": PoolRealArray( 0.4, 0.55, 0.65, 0.8, 0.9 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0.0, 90.0, 90.0, 0.0, 0.0 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:position")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0.15, 0.2, 0.35, 0.4 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 4, 4 ), Vector2( 5, 4 ), Vector2( 3, 4 ), Vector2( 4, 4 ) ]
}
[node name="Turniwood" type="Node2D"]
script = ExtResource( 1 )