Added FSM Node to Player; might be chickening out

This commit is contained in:
Adam Burns 2025-11-04 20:11:03 -05:00
parent e8e7e7bbe5
commit 4f58c4c0d4
3 changed files with 25 additions and 8 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=56 format=3 uid="uid://d3y1iqmpknpyo"]
[gd_scene load_steps=57 format=3 uid="uid://d3y1iqmpknpyo"]
[ext_resource type="Script" uid="uid://d3hp5rjoph7hg" path="res://scripts/player.gd" id="1_3vyb7"]
[ext_resource type="Texture2D" uid="uid://dr3rp5hv7rexv" path="res://graphics/animations/Player Idle 48x48.png" id="2_g2els"]
@ -7,6 +7,7 @@
[ext_resource type="Texture2D" uid="uid://bgp8oow6hgh5o" path="res://graphics/animations/player run 48x48.png" id="4_qlg0r"]
[ext_resource type="Texture2D" uid="uid://dadvc8tsvmkb6" path="res://graphics/animations/Player Running Shooting 48x48.png" id="5_tuyoq"]
[ext_resource type="Texture2D" uid="uid://crll0t2wjtsly" path="res://graphics/animations/player shoot 2H 48x48.png" id="6_fjrip"]
[ext_resource type="Script" uid="uid://bo1v353uh33hx" path="res://scenes/state_machine.gd" id="8_smehm"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_3vyb7"]
radius = 6.0
@ -381,6 +382,16 @@ metadata/_edit_group_ = true
shape = SubResource("CapsuleShape2D_3vyb7")
debug_color = Color(0.521569, 0.572549, 0, 1)
[node name="PlayerSprite" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_3vyb7")
animation = &"punch"
autoplay = "idle"
frame = 7
frame_progress = 1.0
[node name="StateMachine" type="Node" parent="."]
script = ExtResource("8_smehm")
[node name="RightCast" type="RayCast2D" parent="."]
target_position = Vector2(50, 0)
collision_mask = 6
@ -395,13 +406,6 @@ position = Vector2(16, -7)
[node name="LeftSpawn" type="Marker2D" parent="."]
position = Vector2(-16, -7)
[node name="PlayerSprite" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_3vyb7")
animation = &"punch"
autoplay = "idle"
frame = 7
frame_progress = 1.0
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(0, -50)

12
scenes/state_machine.gd Normal file
View File

@ -0,0 +1,12 @@
class_name StateMachine
extends Node
## Node-based Finite State Machine (FSM) for the player
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -0,0 +1 @@
uid://bo1v353uh33hx