capri/objects/player/player.tscn
2025-03-02 18:02:05 -05:00

207 lines
7.7 KiB
Text

[gd_scene load_steps=19 format=3 uid="uid://mh2gfm7iqqsm"]
[ext_resource type="Script" path="res://objects/player/player.gd" id="1_jgave"]
[ext_resource type="Shader" path="res://assets/shaders/clean_edge.gdshader" id="2_cpj48"]
[ext_resource type="Texture2D" uid="uid://c71nqfyw4a3v4" path="res://assets/textures/player/capri.png" id="3_27a2c"]
[ext_resource type="Script" path="res://scripts/spritesheet_animation/spritesheet_animation.gd" id="4_dldqk"]
[ext_resource type="Script" path="res://addons/godot_state_charts/state_chart.gd" id="5_yg0e1"]
[ext_resource type="Script" path="res://addons/godot_state_charts/compound_state.gd" id="6_nf3pt"]
[ext_resource type="Script" path="res://addons/godot_state_charts/atomic_state.gd" id="7_56odx"]
[ext_resource type="Script" path="res://addons/godot_state_charts/transition.gd" id="8_pgje5"]
[ext_resource type="Script" path="res://addons/godot_state_charts/expression_guard.gd" id="9_ht8un"]
[ext_resource type="Script" path="res://addons/godot_state_charts/not_guard.gd" id="10_jkoqe"]
[sub_resource type="CircleShape2D" id="CircleShape2D_tvyy1"]
radius = 6.0208
[sub_resource type="SeparationRayShape2D" id="SeparationRayShape2D_57odn"]
length = 2.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_12eq7"]
shader = ExtResource("2_cpj48")
shader_parameter/highestColor = Vector3(1, 1, 1)
shader_parameter/similarThreshold = 0.0
shader_parameter/lineWidth = 1.0
[sub_resource type="Resource" id="Resource_g8pxc"]
resource_name = "On Floor"
script = ExtResource("9_ht8un")
expression = "on_floor"
[sub_resource type="Resource" id="Resource_4mj4w"]
script = ExtResource("10_jkoqe")
guard = SubResource("Resource_g8pxc")
[sub_resource type="Resource" id="Resource_kdmd2"]
resource_name = "Horizontal Input"
script = ExtResource("9_ht8un")
expression = "horizontal_input"
[sub_resource type="Resource" id="Resource_p43ft"]
script = ExtResource("10_jkoqe")
guard = SubResource("Resource_kdmd2")
[sub_resource type="Resource" id="Resource_g7rrk"]
resource_name = "Downward Velocity"
script = ExtResource("9_ht8un")
expression = "player.velocity.y >= 0.0"
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("state_chart", "graphics")]
collision_layer = 16
collision_mask = 3
floor_snap_length = 3.0
script = ExtResource("1_jgave")
gravity = 450.0
run_speed = 100.0
jump_force = 180.0
state_chart = NodePath("StateChart")
graphics = NodePath("Graphics")
[node name="CollisionShape" type="CollisionShape2D" parent="."]
position = Vector2(0, -6)
shape = SubResource("CircleShape2D_tvyy1")
debug_color = Color(3.32102e-06, 0.648976, 0.161954, 0.42)
[node name="SeparationShapeRight" type="CollisionShape2D" parent="."]
position = Vector2(5, -2)
shape = SubResource("SeparationRayShape2D_57odn")
debug_color = Color(0.850748, 0.32846, 0.463602, 0.42)
[node name="Graphics" type="Node2D" parent="."]
[node name="Sprite" type="Sprite2D" parent="Graphics"]
material = SubResource("ShaderMaterial_12eq7")
texture = ExtResource("3_27a2c")
offset = Vector2(0, -8)
hframes = 4
vframes = 4
region_rect = Rect2(0, 0, 64, 64)
[node name="Idle" type="Node" parent="Graphics/Sprite"]
script = ExtResource("4_dldqk")
[node name="Bark" type="Node" parent="Graphics/Sprite"]
script = ExtResource("4_dldqk")
first_frame = Vector2i(1, 0)
[node name="Run" type="Node" parent="Graphics/Sprite"]
script = ExtResource("4_dldqk")
first_frame = Vector2i(0, 1)
frames = 3
fps = 8.0
loop = true
[node name="Jump" type="Node" parent="Graphics/Sprite"]
script = ExtResource("4_dldqk")
first_frame = Vector2i(2, 0)
[node name="Fall" type="Node" parent="Graphics/Sprite"]
script = ExtResource("4_dldqk")
first_frame = Vector2i(3, 0)
[node name="StateChart" type="Node" parent="."]
script = ExtResource("5_yg0e1")
track_in_editor = true
initial_expression_properties = {
"horizontal_input": false,
"on_floor": true,
"player": null
}
[node name="Root" type="Node" parent="StateChart"]
script = ExtResource("6_nf3pt")
initial_state = NodePath("Grounded")
[node name="Grounded" type="Node" parent="StateChart/Root"]
script = ExtResource("6_nf3pt")
initial_state = NodePath("Standing")
[node name="When Not On Floor" type="Node" parent="StateChart/Root/Grounded"]
script = ExtResource("8_pgje5")
to = NodePath("../../Airborne")
guard = SubResource("Resource_4mj4w")
delay_in_seconds = "0.0"
[node name="On ice_touched" type="Node" parent="StateChart/Root/Grounded"]
script = ExtResource("8_pgje5")
to = NodePath("../Sliding")
event = &"ice_touched"
delay_in_seconds = "0.0"
[node name="On jump_pressed" type="Node" parent="StateChart/Root/Grounded"]
script = ExtResource("8_pgje5")
to = NodePath("../../Airborne/Jumping")
event = &"jump_pressed"
delay_in_seconds = "0.0"
[node name="Standing" type="Node" parent="StateChart/Root/Grounded"]
script = ExtResource("7_56odx")
[node name="If Horizontal Input" type="Node" parent="StateChart/Root/Grounded/Standing"]
script = ExtResource("8_pgje5")
to = NodePath("../../Running")
guard = SubResource("Resource_kdmd2")
delay_in_seconds = "0.0"
[node name="Sliding" type="Node" parent="StateChart/Root/Grounded"]
script = ExtResource("7_56odx")
[node name="On ground_touched" type="Node" parent="StateChart/Root/Grounded/Sliding"]
script = ExtResource("8_pgje5")
to = NodePath("../../Standing")
event = &"ground_touched"
delay_in_seconds = "0.0"
[node name="Running" type="Node" parent="StateChart/Root/Grounded"]
script = ExtResource("7_56odx")
[node name="If No Horizontal Input" type="Node" parent="StateChart/Root/Grounded/Running"]
script = ExtResource("8_pgje5")
to = NodePath("../../Standing")
guard = SubResource("Resource_p43ft")
delay_in_seconds = "0.0"
[node name="Barking" type="Node" parent="StateChart/Root/Grounded"]
script = ExtResource("7_56odx")
[node name="On Timeout" type="Node" parent="StateChart/Root/Grounded/Barking"]
script = ExtResource("8_pgje5")
to = NodePath("../../Standing")
delay_in_seconds = "0.5"
[node name="Airborne" type="Node" parent="StateChart/Root"]
script = ExtResource("6_nf3pt")
initial_state = NodePath("Falling")
[node name="Jumping" type="Node" parent="StateChart/Root/Airborne"]
script = ExtResource("7_56odx")
[node name="When Jump Peaked" type="Node" parent="StateChart/Root/Airborne/Jumping"]
script = ExtResource("8_pgje5")
to = NodePath("../../Falling")
guard = SubResource("Resource_g7rrk")
delay_in_seconds = "0.0"
[node name="Falling" type="Node" parent="StateChart/Root/Airborne"]
script = ExtResource("7_56odx")
[node name="When On Floor" type="Node" parent="StateChart/Root/Airborne/Falling"]
script = ExtResource("8_pgje5")
to = NodePath("../../../Grounded")
guard = SubResource("Resource_g8pxc")
delay_in_seconds = "0.0"
[node name="Voice" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
bus = &"Capri"
[connection signal="state_entered" from="StateChart/Root/Grounded/Standing" to="." method="_stop_moving"]
[connection signal="state_entered" from="StateChart/Root/Grounded/Standing" to="Graphics/Sprite/Idle" method="play"]
[connection signal="state_entered" from="StateChart/Root/Grounded/Sliding" to="Graphics/Sprite/Idle" method="play"]
[connection signal="state_entered" from="StateChart/Root/Grounded/Running" to="Graphics/Sprite/Run" method="play"]
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Running" to="." method="_process_run"]
[connection signal="state_entered" from="StateChart/Root/Grounded/Barking" to="Graphics/Sprite/Bark" method="play"]
[connection signal="state_physics_processing" from="StateChart/Root/Airborne" to="." method="_process_gravity"]
[connection signal="state_entered" from="StateChart/Root/Airborne/Jumping" to="." method="_do_jump"]
[connection signal="state_entered" from="StateChart/Root/Airborne/Jumping" to="Graphics/Sprite/Jump" method="play"]
[connection signal="state_entered" from="StateChart/Root/Airborne/Falling" to="Graphics/Sprite/Fall" method="play"]