create player idle state
This commit is contained in:
parent
e07315023c
commit
2a865423dc
3 changed files with 28 additions and 1 deletions
|
|
@ -1,7 +1,9 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cqm5besqgsb7x"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cqm5besqgsb7x"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dpsocqnk0e6le" path="res://scenes/player/player.gd" id="1_dovo2"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://6v5nyv2wo47g" path="res://scenes/player/assets/yukotsuki.aseprite" id="2_dovo2"]
|
||||
[ext_resource type="Script" uid="uid://diths5s8vd7lr" path="res://classes/state_machine/state_machine.gd" id="2_lvxji"]
|
||||
[ext_resource type="Script" uid="uid://cl6snimpmxcvu" path="res://scenes/player/states/player_idle.gd" id="3_p47bc"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_gmlin"]
|
||||
radius = 6.0
|
||||
|
|
@ -11,6 +13,14 @@ height = 14.0
|
|||
collision_mask = 2
|
||||
script = ExtResource("1_dovo2")
|
||||
|
||||
[node name="StateMachine" type="Node" parent="."]
|
||||
script = ExtResource("2_lvxji")
|
||||
metadata/_custom_type_script = "uid://diths5s8vd7lr"
|
||||
|
||||
[node name="Idle" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("3_p47bc")
|
||||
metadata/_custom_type_script = "uid://bebe1y51hwns8"
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(0, -16)
|
||||
sprite_frames = ExtResource("2_dovo2")
|
||||
|
|
|
|||
16
scenes/player/states/player_idle.gd
Normal file
16
scenes/player/states/player_idle.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
extends PlayerState
|
||||
|
||||
|
||||
var next_state: StringName
|
||||
|
||||
|
||||
func _enter(_previous_state_path: String, _data: Dictionary[StringName, Variant] = {}) -> void:
|
||||
print('entering idle')
|
||||
#print('entered')
|
||||
|
||||
|
||||
func _state_physics_update(_delta: float) -> void:
|
||||
next_state = player.match_state([IDLE])
|
||||
if next_state != "":
|
||||
print(next_state)
|
||||
#finished.emit(next_state)
|
||||
1
scenes/player/states/player_idle.gd.uid
Normal file
1
scenes/player/states/player_idle.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cl6snimpmxcvu
|
||||
Loading…
Add table
Reference in a new issue