Removed animation loops
This commit is contained in:
+30
-30
@@ -11,49 +11,49 @@ enum PickupState {PREPARING, SHOWING_UP, IDLING, HIGHLIGHTING}
|
|||||||
|
|
||||||
|
|
||||||
const ANIMATIONS_BY_TYPE := {
|
const ANIMATIONS_BY_TYPE := {
|
||||||
PickupType.CHERRY: "cherry",
|
PickupType.CHERRY: "cherry",
|
||||||
PickupType.FLY_AGARIC: "fly_agaric",
|
PickupType.FLY_AGARIC: "fly_agaric",
|
||||||
PickupType.GREEN_APPLE: "green_apple",
|
PickupType.GREEN_APPLE: "green_apple",
|
||||||
PickupType.RED_APPLE: "red_apple",
|
PickupType.RED_APPLE: "red_apple",
|
||||||
}
|
}
|
||||||
|
|
||||||
const ANIMATIONS_BY_STATE := {
|
const ANIMATIONS_BY_STATE := {
|
||||||
PickupState.PREPARING: "preparing",
|
PickupState.PREPARING: "preparing",
|
||||||
PickupState.SHOWING_UP: "showing_up",
|
PickupState.SHOWING_UP: "showing_up",
|
||||||
PickupState.IDLING: "idling",
|
PickupState.IDLING: "idling",
|
||||||
PickupState.HIGHLIGHTING: "highlighting",
|
PickupState.HIGHLIGHTING: "highlighting",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
_play_animation()
|
_play_animation()
|
||||||
|
|
||||||
|
|
||||||
func _play_animation() -> void:
|
func _play_animation() -> void:
|
||||||
var animation : String
|
var animation : String
|
||||||
if state == PickupState.PREPARING:
|
if state == PickupState.PREPARING:
|
||||||
animation = ANIMATIONS_BY_STATE[state]
|
animation = ANIMATIONS_BY_STATE[state]
|
||||||
else:
|
else:
|
||||||
animation = "%s_%s" % [
|
animation = "%s_%s" % [
|
||||||
ANIMATIONS_BY_TYPE[type],
|
ANIMATIONS_BY_TYPE[type],
|
||||||
ANIMATIONS_BY_STATE[state]
|
ANIMATIONS_BY_STATE[state]
|
||||||
]
|
]
|
||||||
$AnimatedSprite2D.play(animation)
|
$AnimatedSprite2D.play(animation)
|
||||||
|
|
||||||
|
|
||||||
func _on_animated_sprite_2d_animation_finished() -> void:
|
func _on_animated_sprite_2d_animation_finished() -> void:
|
||||||
match state:
|
match state:
|
||||||
PickupState.PREPARING:
|
PickupState.PREPARING:
|
||||||
state = PickupState.SHOWING_UP
|
state = PickupState.SHOWING_UP
|
||||||
_play_animation()
|
_play_animation()
|
||||||
PickupState.SHOWING_UP:
|
PickupState.SHOWING_UP:
|
||||||
state = PickupState.IDLING
|
state = PickupState.IDLING
|
||||||
_play_animation()
|
_play_animation()
|
||||||
PickupState.HIGHLIGHTING:
|
PickupState.HIGHLIGHTING:
|
||||||
state = PickupState.IDLING
|
state = PickupState.IDLING
|
||||||
_play_animation()
|
_play_animation()
|
||||||
|
|
||||||
|
|
||||||
func highlight() -> void:
|
func highlight() -> void:
|
||||||
state = PickupState.HIGHLIGHTING
|
state = PickupState.HIGHLIGHTING
|
||||||
_play_animation()
|
_play_animation()
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ extends StaticBody2D
|
|||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=324 format=3 uid="uid://wnxjoy61hocf"]
|
[gd_scene load_steps=324 format=3 uid="uid://wnxjoy61hocf"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://snake_segment.gd" id="1_edgpa"]
|
[ext_resource type="Script" uid="uid://cl8has1236st4" path="res://snake_segment.gd" id="1_edgpa"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bl4w670870hf5" path="res://data/images/Snake.png" id="2_dj5ef"]
|
[ext_resource type="Texture2D" uid="uid://bl4w670870hf5" path="res://data/images/Snake.png" id="2_dj5ef"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_oevm2"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_oevm2"]
|
||||||
@@ -2030,7 +2030,7 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_aht5m")
|
"texture": SubResource("AtlasTexture_aht5m")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": false,
|
||||||
"name": &"left-tail-down-phase-2",
|
"name": &"left-tail-down-phase-2",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
@@ -2118,7 +2118,7 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_gmed7")
|
"texture": SubResource("AtlasTexture_gmed7")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": false,
|
||||||
"name": &"left-tail-up-phase-2",
|
"name": &"left-tail-up-phase-2",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
@@ -2436,7 +2436,7 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_u5e6r")
|
"texture": SubResource("AtlasTexture_u5e6r")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": false,
|
||||||
"name": &"left-turn-up-in-phase-2",
|
"name": &"left-turn-up-in-phase-2",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
@@ -2585,7 +2585,7 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_tpoi5")
|
"texture": SubResource("AtlasTexture_tpoi5")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": false,
|
||||||
"name": &"left-turn-up-tail-phase-2",
|
"name": &"left-turn-up-tail-phase-2",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
@@ -2759,7 +2759,7 @@ metadata/_edit_group_ = true
|
|||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
position = Vector2(8, 8)
|
position = Vector2(8, 8)
|
||||||
sprite_frames = SubResource("SpriteFrames_u31w8")
|
sprite_frames = SubResource("SpriteFrames_u31w8")
|
||||||
animation = &"left-turn-up-tail-phase-2"
|
animation = &"left-waves-down"
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(8, 8)
|
position = Vector2(8, 8)
|
||||||
|
|||||||
Reference in New Issue
Block a user