Added more left animations
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 52 KiB |
+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
|
||||||
|
|||||||
+1455
-210
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user