Skip to content

Commit 1d8fa9c

Browse files
Yaxianaaronfranke
andauthored
Add player_state dictionary to manage player state names for FSM demo (#1143)
* Add player_state dictionary to manage player state names for FSM demo * Use a constant typed Dictionary of StringNames and update to Godot 4.5 --------- Co-authored-by: Aaron Franke <[email protected]>
1 parent 69b3176 commit 1d8fa9c

40 files changed

+108
-67
lines changed

2d/finite_state_machine/Demo.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ start_state = NodePath("Idle")
4141

4242
[node name="AnimationPlayer" parent="Player" index="1"]
4343
libraries = {
44-
"": SubResource("AnimationLibrary_qbwwp")
44+
&"": SubResource("AnimationLibrary_qbwwp")
4545
}
4646

4747
[node name="StateNameDisplayer" parent="Player" index="5"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
uid://8e5wvxrlv1ct
1+
uid://h4p2eq3snhjs

2d/finite_state_machine/fonts/SourceCodePro-Bold.ttf.import

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ msdf_pixel_range=8
2121
msdf_size=48
2222
allow_system_fallback=true
2323
force_autohinter=false
24+
modulate_color_glyphs=false
2425
hinting=1
2526
subpixel_positioning=1
2627
keep_rounding_remainders=true

2d/finite_state_machine/icon.webp.import

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ct
1818
compress/mode=0
1919
compress/high_quality=false
2020
compress/lossy_quality=0.7
21+
compress/uastc_level=0
22+
compress/rdo_quality_loss=0.0
2123
compress/hdr_compression=1
2224
compress/normal_map=0
2325
compress/channel_pack=0
2426
mipmaps/generate=false
2527
mipmaps/limit=-1
2628
roughness/mode=0
2729
roughness/src_normal=""
30+
process/channel_remap/red=0
31+
process/channel_remap/green=1
32+
process/channel_remap/blue=2
33+
process/channel_remap/alpha=3
2834
process/fix_alpha_border=true
2935
process/premult_alpha=false
3036
process/normal_map_invert_y=false

2d/finite_state_machine/player/body.png.import

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ dest_files=["res://.godot/imported/body.png-313f6363670a5852a7b7126ab476d8b1.cte
1818
compress/mode=0
1919
compress/high_quality=false
2020
compress/lossy_quality=0.7
21+
compress/uastc_level=0
22+
compress/rdo_quality_loss=0.0
2123
compress/hdr_compression=1
2224
compress/normal_map=0
2325
compress/channel_pack=0
2426
mipmaps/generate=false
2527
mipmaps/limit=-1
2628
roughness/mode=0
2729
roughness/src_normal=""
30+
process/channel_remap/red=0
31+
process/channel_remap/green=1
32+
process/channel_remap/blue=2
33+
process/channel_remap/alpha=3
2834
process/fix_alpha_border=true
2935
process/premult_alpha=false
3036
process/normal_map_invert_y=false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
uid://crm4tdogdpumr
1+
uid://b44c6s1shm5f7

2d/finite_state_machine/player/bullet/bullet_spawner.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ extends Node2D
22

33
var bullet := preload("Bullet.tscn")
44

5-
func _unhandled_input(event: InputEvent) -> void:
6-
if event.is_action_pressed("fire"):
5+
func _unhandled_input(input_event: InputEvent) -> void:
6+
if input_event.is_action_pressed("fire"):
77
fire()
88

99

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
uid://duw4ejcjfrp7o
1+
uid://toean0857ojh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
uid://clya0ymtv6cnn
1+
uid://bctcyb2y6vuvd
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
extends "res://state_machine/state.gd"
2+
3+
const PLAYER_STATE: Dictionary[StringName, StringName]= {
4+
&"previous": &"previous",
5+
&"jump": &"jump",
6+
&"idle": &"idle",
7+
&"move": &"move",
8+
&"stagger": &"stagger",
9+
&"attack": &"attack",
10+
&"die": &"die",
11+
&"dead": &"dead",
12+
&"walk": &"walk",
13+
}

0 commit comments

Comments
 (0)