it just werks

This commit is contained in:
pennyrigate 2025-03-02 18:02:05 -05:00
parent 1311e18f1f
commit 7e26433676
50 changed files with 1181 additions and 11 deletions

View file

@ -0,0 +1,18 @@
extends Node2D
@export var next_map:PackedScene
# 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
func _on_area_2d_body_entered(body: Node2D) -> void:
if body is Player:
SceneManager.current_scene = next_map.instantiate()
SceneManager.win_sound.play()

View file

@ -0,0 +1,22 @@
[gd_scene load_steps=4 format=3 uid="uid://bhnse651bcybm"]
[ext_resource type="Texture2D" uid="uid://bwq21el575t1g" path="res://assets/textures/door/door.png" id="1_4beu0"]
[ext_resource type="Script" path="res://objects/end_door/end_door.gd" id="1_ph88k"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qkffx"]
size = Vector2(16, 16)
[node name="EndDoor" type="Node2D"]
script = ExtResource("1_ph88k")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_4beu0")
[node name="Area2D" type="Area2D" parent="."]
collision_mask = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("RectangleShape2D_qkffx")
debug_color = Color(0, 1, 0.701961, 0.419608)
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]

View file

@ -10,6 +10,9 @@ extends CharacterBody2D
@export var state_chart: StateChart
@export var graphics: Node2D
@onready var start_position = position
@onready var voice = %Voice
var ices_touched:int = 0:
set(value):
ices_touched = value
@ -23,7 +26,6 @@ var ices_touched:int = 0:
func _ready() -> void:
state_chart.set_expression_property(&"player", self)
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed(&"ui_accept"):
state_chart.send_event(&"jump_pressed")
@ -59,6 +61,8 @@ func _process_gravity(delta: float) -> void:
#region State One-Shots
func _do_jump() -> void:
voice.stream = load("res://assets/audio/vox/capri_jump.ogg")
voice.play()
velocity.y = -jump_force
position.y -= 1.0

View file

@ -51,9 +51,9 @@ collision_layer = 16
collision_mask = 3
floor_snap_length = 3.0
script = ExtResource("1_jgave")
gravity = 400.0
run_speed = 76.0
jump_force = 150.0
gravity = 450.0
run_speed = 100.0
jump_force = 180.0
state_chart = NodePath("StateChart")
graphics = NodePath("Graphics")
@ -191,6 +191,10 @@ 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"]

View file

@ -68,7 +68,6 @@ script = ExtResource("1_7ck2q")
texture = ExtResource("2_3s2uc")
target = NodePath("../RotatingPiece/SnakeEndLeft")
segments = 2
head_segment = true
tail_segment = false
auto_density = true
pixels_per_segment = 6.0
@ -78,7 +77,6 @@ script = ExtResource("1_7ck2q")
texture = ExtResource("2_3s2uc")
target = NodePath("../RotatingPiece/SnakeEndRight")
segments = 2
head_segment = true
tail_segment = false
auto_density = true
pixels_per_segment = 6.0

View file

@ -0,0 +1,67 @@
[gd_scene load_steps=7 format=3 uid="uid://cnqmbq84hbnvj"]
[ext_resource type="Texture2D" uid="uid://cmjre2dn67avi" path="res://assets/textures/spikes/spikes.png" id="1_hxbnl"]
[ext_resource type="Script" path="res://objects/spikes/spikes.gd" id="1_sx6gd"]
[sub_resource type="Animation" id="Animation_iol55"]
resource_name = "spike"
length = 0.2
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0333333, 0.0666667, 0.1, 0.133333, 0.166667, 0.2),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 1, 3, 4, 3]
}
[sub_resource type="Animation" id="Animation_owgdn"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7km18"]
_data = {
"RESET": SubResource("Animation_owgdn"),
"spike": SubResource("Animation_iol55")
}
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1d2d3"]
size = Vector2(12, 12)
[node name="Spikes" type="Node2D"]
script = ExtResource("1_sx6gd")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_hxbnl")
hframes = 5
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_7km18")
}
autoplay = "spike"
[node name="Area2D" type="Area2D" parent="."]
collision_mask = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(0, 1)
shape = SubResource("RectangleShape2D_1d2d3")
[connection signal="body_shape_entered" from="Area2D" to="." method="_on_area_2d_body_shape_entered"]

View file

@ -0,0 +1,67 @@
[gd_scene load_steps=7 format=3 uid="uid://cnqmbq84hbnvj"]
[ext_resource type="Texture2D" uid="uid://cmjre2dn67avi" path="res://assets/textures/spikes/spikes.png" id="1_hxbnl"]
[ext_resource type="Script" path="res://objects/spikes/spikes.gd" id="1_sx6gd"]
[sub_resource type="Animation" id="Animation_iol55"]
resource_name = "spike"
length = 0.2
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0333333, 0.0666667, 0.1, 0.133333, 0.166667, 0.2),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 1, 3, 4, 3]
}
[sub_resource type="Animation" id="Animation_owgdn"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7km18"]
_data = {
"RESET": SubResource("Animation_owgdn"),
"spike": SubResource("Animation_iol55")
}
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1d2d3"]
size = Vector2(12, 12)
[node name="Spikes" type="Node2D"]
script = ExtResource("1_sx6gd")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_hxbnl")
hframes = 5
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_7km18")
}
autoplay = "spike"
[node name="Area2D" type="Area2D" parent="."]
collision_mask = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(0, 1)
shape = SubResource("RectangleShape2D_1d2d3")
[connection signal="body_shape_entered" from="Area2D" to="." method="_on_area_2d_body_shape_entered"]

18
objects/spikes/spikes.gd Normal file
View file

@ -0,0 +1,18 @@
extends Node2D
# 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
func _on_area_2d_body_shape_entered(body_rid: RID, body: Node2D, body_shape_index: int, local_shape_index: int) -> void:
if body is Player:
body.position = body.start_position
body.voice.stream = load("res://assets/audio/vox/capri_die.ogg")
body.voice.play()

View file

@ -0,0 +1,67 @@
[gd_scene load_steps=7 format=3 uid="uid://cnqmbq84hbnvj"]
[ext_resource type="Texture2D" uid="uid://cmjre2dn67avi" path="res://assets/textures/spikes/spikes.png" id="1_hxbnl"]
[ext_resource type="Script" path="res://objects/spikes/spikes.gd" id="1_sx6gd"]
[sub_resource type="Animation" id="Animation_iol55"]
resource_name = "spike"
length = 0.2
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0333333, 0.0666667, 0.1, 0.133333, 0.166667, 0.2),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 1, 3, 4, 3]
}
[sub_resource type="Animation" id="Animation_owgdn"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7km18"]
_data = {
"RESET": SubResource("Animation_owgdn"),
"spike": SubResource("Animation_iol55")
}
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1d2d3"]
size = Vector2(12, 12)
[node name="Spikes" type="Node2D"]
script = ExtResource("1_sx6gd")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_hxbnl")
hframes = 5
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_7km18")
}
autoplay = "spike"
[node name="Area2D" type="Area2D" parent="."]
collision_mask = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(0, 1)
shape = SubResource("RectangleShape2D_1d2d3")
[connection signal="body_shape_entered" from="Area2D" to="." method="_on_area_2d_body_shape_entered"]

View file

@ -19,4 +19,5 @@ func _on_area_2d_body_entered(body: Node2D) -> void:
else:
body.velocity.y = (body.jump_force * 1.5) * sign(-body.velocity.y)
body.velocity.x += body.graphics.scale.x * 20.0
%AudioStreamPlayer.play()
%AnimationPlayer.play("bounce")

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://68lav5rke5ag"]
[gd_scene load_steps=8 format=3 uid="uid://68lav5rke5ag"]
[ext_resource type="Script" path="res://objects/spring/spring.gd" id="1_05bif"]
[ext_resource type="Texture2D" uid="uid://bobpl8pwm216q" path="res://assets/textures/spring/spring.png" id="1_s1olr"]
[ext_resource type="AudioStream" uid="uid://b8q3dww80nicd" path="res://assets/audio/sfx/jump.wav" id="3_wq8v8"]
[sub_resource type="Animation" id="Animation_pa4d8"]
length = 0.001
@ -64,5 +65,11 @@ collision_mask = 16
position = Vector2(0, -5.5)
shape = SubResource("RectangleShape2D_c7407")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("3_wq8v8")
volume_db = -14.0
bus = &"Capri"
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]