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 := {
|
||||
PickupType.CHERRY: "cherry",
|
||||
PickupType.FLY_AGARIC: "fly_agaric",
|
||||
PickupType.GREEN_APPLE: "green_apple",
|
||||
PickupType.RED_APPLE: "red_apple",
|
||||
PickupType.CHERRY: "cherry",
|
||||
PickupType.FLY_AGARIC: "fly_agaric",
|
||||
PickupType.GREEN_APPLE: "green_apple",
|
||||
PickupType.RED_APPLE: "red_apple",
|
||||
}
|
||||
|
||||
const ANIMATIONS_BY_STATE := {
|
||||
PickupState.PREPARING: "preparing",
|
||||
PickupState.SHOWING_UP: "showing_up",
|
||||
PickupState.IDLING: "idling",
|
||||
PickupState.HIGHLIGHTING: "highlighting",
|
||||
PickupState.PREPARING: "preparing",
|
||||
PickupState.SHOWING_UP: "showing_up",
|
||||
PickupState.IDLING: "idling",
|
||||
PickupState.HIGHLIGHTING: "highlighting",
|
||||
}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_play_animation()
|
||||
_play_animation()
|
||||
|
||||
|
||||
func _play_animation() -> void:
|
||||
var animation : String
|
||||
if state == PickupState.PREPARING:
|
||||
animation = ANIMATIONS_BY_STATE[state]
|
||||
else:
|
||||
animation = "%s_%s" % [
|
||||
ANIMATIONS_BY_TYPE[type],
|
||||
ANIMATIONS_BY_STATE[state]
|
||||
]
|
||||
$AnimatedSprite2D.play(animation)
|
||||
var animation : String
|
||||
if state == PickupState.PREPARING:
|
||||
animation = ANIMATIONS_BY_STATE[state]
|
||||
else:
|
||||
animation = "%s_%s" % [
|
||||
ANIMATIONS_BY_TYPE[type],
|
||||
ANIMATIONS_BY_STATE[state]
|
||||
]
|
||||
$AnimatedSprite2D.play(animation)
|
||||
|
||||
|
||||
func _on_animated_sprite_2d_animation_finished() -> void:
|
||||
match state:
|
||||
PickupState.PREPARING:
|
||||
state = PickupState.SHOWING_UP
|
||||
_play_animation()
|
||||
PickupState.SHOWING_UP:
|
||||
state = PickupState.IDLING
|
||||
_play_animation()
|
||||
PickupState.HIGHLIGHTING:
|
||||
state = PickupState.IDLING
|
||||
_play_animation()
|
||||
match state:
|
||||
PickupState.PREPARING:
|
||||
state = PickupState.SHOWING_UP
|
||||
_play_animation()
|
||||
PickupState.SHOWING_UP:
|
||||
state = PickupState.IDLING
|
||||
_play_animation()
|
||||
PickupState.HIGHLIGHTING:
|
||||
state = PickupState.IDLING
|
||||
_play_animation()
|
||||
|
||||
|
||||
func highlight() -> void:
|
||||
state = PickupState.HIGHLIGHTING
|
||||
_play_animation()
|
||||
state = PickupState.HIGHLIGHTING
|
||||
_play_animation()
|
||||
|
||||
@@ -2,4 +2,4 @@ extends StaticBody2D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
pass
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[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"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_oevm2"]
|
||||
@@ -2030,7 +2030,7 @@ animations = [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_aht5m")
|
||||
}],
|
||||
"loop": true,
|
||||
"loop": false,
|
||||
"name": &"left-tail-down-phase-2",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
@@ -2118,7 +2118,7 @@ animations = [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gmed7")
|
||||
}],
|
||||
"loop": true,
|
||||
"loop": false,
|
||||
"name": &"left-tail-up-phase-2",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
@@ -2436,7 +2436,7 @@ animations = [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_u5e6r")
|
||||
}],
|
||||
"loop": true,
|
||||
"loop": false,
|
||||
"name": &"left-turn-up-in-phase-2",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
@@ -2585,7 +2585,7 @@ animations = [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tpoi5")
|
||||
}],
|
||||
"loop": true,
|
||||
"loop": false,
|
||||
"name": &"left-turn-up-tail-phase-2",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
@@ -2759,7 +2759,7 @@ metadata/_edit_group_ = true
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(8, 8)
|
||||
sprite_frames = SubResource("SpriteFrames_u31w8")
|
||||
animation = &"left-turn-up-tail-phase-2"
|
||||
animation = &"left-waves-down"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(8, 8)
|
||||
|
||||
Reference in New Issue
Block a user