Add sound effects for player actions and collectables

This commit is contained in:
2025-04-26 02:15:23 +02:00
parent 8959fd4b9f
commit f01645c094
46 changed files with 897 additions and 1058 deletions

BIN
fonts/Inter.ttc Normal file

Binary file not shown.

34
fonts/Inter.ttc.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bsnspwkhs2eap"
path="res://.godot/imported/Inter.ttc-66d76f800dedd3967228b370d7774514.fontdata"
[deps]
source_file="res://fonts/Inter.ttc"
dest_files=["res://.godot/imported/Inter.ttc-66d76f800dedd3967228b370d7774514.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

View File

@@ -0,0 +1,34 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://cqs7f38j5u0j0"
path="res://.godot/imported/InterVariable-Italic.ttf-03e2504c45660d1cd4db6440fe572d25.fontdata"
[deps]
source_file="res://fonts/InterVariable-Italic.ttf"
dest_files=["res://.godot/imported/InterVariable-Italic.ttf-03e2504c45660d1cd4db6440fe572d25.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

BIN
fonts/InterVariable.ttf Normal file

Binary file not shown.

View File

@@ -0,0 +1,34 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://dej0q3v4q1bo8"
path="res://.godot/imported/InterVariable.ttf-e7612f6aa3b6b222ac8885ca7804ade8.fontdata"
[deps]
source_file="res://fonts/InterVariable.ttf"
dest_files=["res://.godot/imported/InterVariable.ttf-e7612f6aa3b6b222ac8885ca7804ade8.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://bargnp4twtmxg"]
[gd_scene load_steps=7 format=3 uid="uid://bargnp4twtmxg"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_aya2w"]
[ext_resource type="Script" path="res://scripts/components/collectable.gd" id="2_7cph7"]
[ext_resource type="Resource" uid="uid://bsnr5v2b2mfsl" path="res://resources/collectables/big_coin.tres" id="3_lk3av"]
[ext_resource type="Script" path="res://scripts/components/fade_away.gd" id="4_wkrj0"]
[ext_resource type="AudioStream" uid="uid://bceic1csr8rq3" path="res://sfx/pickup_coin_2.wav" id="5_dbffd"]
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
radius = 9.0
@@ -22,10 +23,11 @@ hframes = 12
vframes = 12
frame = 51
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d") groups=["coins"]]
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d", "sfx") groups=["coins"]]
script = ExtResource("2_7cph7")
area2d = NodePath("..")
collectable_data = ExtResource("3_lk3av")
sfx = NodePath("../sfx")
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")]
script = ExtResource("4_wkrj0")
@@ -33,3 +35,7 @@ sprite2d = NodePath("../Sprite2D")
fade_duration = 0.4
root = NodePath("..")
area2d = NodePath("..")
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_dbffd")
volume_db = -5.0

View File

@@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://d08dfqmirnd66"]
[gd_scene load_steps=7 format=3 uid="uid://d08dfqmirnd66"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1co1x"]
[ext_resource type="Script" path="res://scripts/components/collectable.gd" id="2_cujcq"]
[ext_resource type="Resource" uid="uid://b6xqotmke54x" path="res://resources/collectables/big_treasure.tres" id="3_k64cr"]
[ext_resource type="Script" path="res://scripts/components/fade_away.gd" id="4_nw7tw"]
[ext_resource type="AudioStream" uid="uid://wr7n5ivv06ux" path="res://sfx/pickup_coin_4.wav" id="5_fxf8v"]
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
radius = 9.0
@@ -21,10 +22,11 @@ hframes = 12
vframes = 12
frame = 64
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d") groups=["coins"]]
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d", "sfx") groups=["coins"]]
script = ExtResource("2_cujcq")
area2d = NodePath("..")
collectable_data = ExtResource("3_k64cr")
sfx = NodePath("../sfx")
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")]
script = ExtResource("4_nw7tw")
@@ -32,3 +34,6 @@ sprite2d = NodePath("../Sprite2D")
fade_duration = 0.4
root = NodePath("..")
area2d = NodePath("..")
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_fxf8v")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://bqi5s710xb1ju"]
[gd_scene load_steps=24 format=3 uid="uid://bqi5s710xb1ju"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_8j4h4"]
[ext_resource type="Texture2D" uid="uid://b7gp0gqvkv8j4" path="res://sprites/MrBrick_base.png" id="2_bc55y"]
@@ -17,6 +17,9 @@
[ext_resource type="Script" path="res://scripts/components/magnetic_skill.gd" id="15_4df3h"]
[ext_resource type="Script" path="res://scripts/components/can_be_launched_component.gd" id="16_kemlv"]
[ext_resource type="Script" path="res://scripts/components/trigger_lever_component.gd" id="17_hglfj"]
[ext_resource type="AudioStream" uid="uid://duj2q0rqytaxg" path="res://sfx/jump.wav" id="18_pysae"]
[ext_resource type="AudioStream" uid="uid://bmfn6p88gy575" path="res://sfx/player_hurt.wav" id="19_7anly"]
[ext_resource type="AudioStream" uid="uid://ycgtf6wj7mto" path="res://sfx/heal.wav" id="20_bptj5"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hdsg1"]
size = Vector2(16, 31)
@@ -27,10 +30,11 @@ size = Vector2(16, 32)
[sub_resource type="CircleShape2D" id="CircleShape2D_ps31c"]
radius = 48.0
[node name="Brick Player" type="CharacterBody2D"]
[node name="Brick Player" type="CharacterBody2D" node_paths=PackedStringArray("jump_sfx")]
collision_layer = 4
collision_mask = 43
script = ExtResource("1_8j4h4")
jump_sfx = NodePath("sfx_jump")
[node name="Root" type="Node2D" parent="."]
@@ -72,8 +76,10 @@ shape = SubResource("RectangleShape2D_vad0t")
[node name="ScoreComponent" type="Node" parent="."]
script = ExtResource("6_fowa2")
[node name="HealthComponent" type="Node" parent="."]
[node name="HealthComponent" type="Node" parent="." node_paths=PackedStringArray("hurt_fx", "heal_fx")]
script = ExtResource("7_tqjk8")
hurt_fx = NodePath("../sfx_hurt")
heal_fx = NodePath("../sfx_heal")
[node name="PlayerDeathComponent" type="Node" parent="."]
process_mode = 3
@@ -140,5 +146,14 @@ script = ExtResource("16_kemlv")
[node name="TriggerLeverComponent" type="Node" parent="."]
script = ExtResource("17_hglfj")
[node name="sfx_jump" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("18_pysae")
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("19_7anly")
[node name="sfx_heal" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("20_bptj5")
[connection signal="on_death" from="HealthComponent" to="PlayerDeathComponent" method="_on_health_component_on_death"]
[connection signal="on_health_change" from="HealthComponent" to="KnockbackComponent" method="_on_health_component_on_health_change"]

51
objects/child.tscn Normal file
View File

@@ -0,0 +1,51 @@
[gd_scene load_steps=9 format=3 uid="uid://d0s2abysa86rq"]
[ext_resource type="Texture2D" uid="uid://b7gp0gqvkv8j4" path="res://sprites/MrBrick_base.png" id="1_jcisc"]
[ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="2_8jrbi"]
[ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="3_k41y7"]
[ext_resource type="Texture2D" uid="uid://8h05rd26t66q" path="res://sprites/lollipop.png" id="4_vq1oq"]
[ext_resource type="Script" path="res://scripts/components/collectable.gd" id="5_wc3ym"]
[ext_resource type="Resource" uid="uid://b6apusc0jmi3x" path="res://resources/collectables/child.tres" id="6_vmvuo"]
[ext_resource type="AudioStream" uid="uid://drfr0wlgkhkdq" path="res://sfx/child_pickup.wav" id="7_j8eyh"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_dj5g5"]
size = Vector2(10, 20)
[node name="Child" type="Area2D"]
collision_layer = 0
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_dj5g5")
[node name="Root" type="Node2D" parent="."]
[node name="Body" type="Node2D" parent="Root"]
scale = Vector2(0.5, 0.5)
[node name="Base" type="Sprite2D" parent="Root/Body"]
texture = ExtResource("1_jcisc")
[node name="Left Eye" type="Sprite2D" parent="Root/Body"]
position = Vector2(-7, -6)
texture = ExtResource("2_8jrbi")
hframes = 2
[node name="Right Eye" type="Sprite2D" parent="Root/Body"]
position = Vector2(6, -5)
texture = ExtResource("3_k41y7")
hframes = 2
[node name="Sprite2D" type="Sprite2D" parent="Root"]
position = Vector2(6, 1)
rotation = 0.785398
texture = ExtResource("4_vq1oq")
[node name="CollectableComponent" type="Node" parent="." node_paths=PackedStringArray("area2d", "sfx")]
script = ExtResource("5_wc3ym")
area2d = NodePath("..")
collectable_data = ExtResource("6_vmvuo")
sfx = NodePath("../sfx_pickup")
[node name="sfx_pickup" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("7_j8eyh")

View File

@@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://54w4wisfj8v8"]
[gd_scene load_steps=7 format=3 uid="uid://54w4wisfj8v8"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_epuj5"]
[ext_resource type="Script" path="res://scripts/components/collectable.gd" id="2_y0k47"]
[ext_resource type="Resource" uid="uid://vql535ckoeqm" path="res://resources/collectables/coin.tres" id="3_fm2fq"]
[ext_resource type="Script" path="res://scripts/components/fade_away.gd" id="4_fx1h2"]
[ext_resource type="AudioStream" uid="uid://dpyr80hk4kebc" path="res://sfx/pickup_coin_1.wav" id="5_4jc2c"]
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
radius = 9.0
@@ -21,10 +22,11 @@ hframes = 12
vframes = 12
frame = 51
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d") groups=["coins"]]
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d", "sfx") groups=["coins"]]
script = ExtResource("2_y0k47")
area2d = NodePath("..")
collectable_data = ExtResource("3_fm2fq")
sfx = NodePath("../sfx")
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")]
script = ExtResource("4_fx1h2")
@@ -32,3 +34,7 @@ sprite2d = NodePath("../Sprite2D")
fade_duration = 0.4
root = NodePath("..")
area2d = NodePath("..")
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_4jc2c")
volume_db = -5.0

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://bwdlmualj6xbw"]
[gd_scene load_steps=18 format=3 uid="uid://bwdlmualj6xbw"]
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="1_ep4yr"]
[ext_resource type="Texture2D" uid="uid://xes6mt2dd5gu" path="res://sprites/robot_cutout.png" id="1_uh38l"]
@@ -12,6 +12,8 @@
[ext_resource type="Script" path="res://scripts/components/status_effect_component.gd" id="10_5i27q"]
[ext_resource type="Script" path="res://scripts/components/fire_effect_component.gd" id="10_ej8vg"]
[ext_resource type="Script" path="res://scripts/components/ice_effect_component.gd" id="11_pq0k7"]
[ext_resource type="AudioStream" uid="uid://b3tsqhr06pbrs" path="res://sfx/enemy_hurt.wav" id="13_u4k3d"]
[ext_resource type="AudioStream" uid="uid://dyev46uqusimi" path="res://sfx/shoot.wav" id="14_tdjks"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pwwji"]
size = Vector2(18, 27)
@@ -35,8 +37,9 @@ shape = SubResource("RectangleShape2D_pwwji")
material = SubResource("ShaderMaterial_j18j0")
texture = ExtResource("1_uh38l")
[node name="HealthComponent" type="Node" parent="."]
[node name="HealthComponent" type="Node" parent="." node_paths=PackedStringArray("hurt_fx")]
script = ExtResource("2_o170m")
hurt_fx = NodePath("../sfx_hurt")
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d")]
script = ExtResource("4_4eajk")
@@ -105,3 +108,9 @@ root = NodePath("..")
script = ExtResource("11_pq0k7")
components_to_disable = [NodePath("../SideToSideMovement"), NodePath("../PeriodicShootingComponent")]
status_effect_component = NodePath("../StatusEffectComponent")
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("13_u4k3d")
[node name="sfx_shoot" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("14_tdjks")

View File

@@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://073ts5cxtwbl"]
[gd_scene load_steps=7 format=3 uid="uid://073ts5cxtwbl"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_uh3ex"]
[ext_resource type="Script" path="res://scripts/components/collectable.gd" id="2_i1ssp"]
[ext_resource type="Resource" uid="uid://bws2xldndlre1" path="res://resources/collectables/treasure.tres" id="3_uknsr"]
[ext_resource type="Script" path="res://scripts/components/fade_away.gd" id="4_ccbcr"]
[ext_resource type="AudioStream" uid="uid://d2rj7uy5f0kwm" path="res://sfx/pickup_coin_3.wav" id="5_xt2rk"]
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
radius = 9.0
@@ -21,10 +22,11 @@ hframes = 12
vframes = 12
frame = 66
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d") groups=["coins"]]
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d", "sfx") groups=["coins"]]
script = ExtResource("2_i1ssp")
area2d = NodePath("..")
collectable_data = ExtResource("3_uknsr")
sfx = NodePath("../sfx")
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")]
script = ExtResource("4_ccbcr")
@@ -32,3 +34,7 @@ sprite2d = NodePath("../Sprite2D")
fade_duration = 0.4
root = NodePath("..")
area2d = NodePath("..")
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_xt2rk")
volume_db = -5.0

View File

@@ -0,0 +1,7 @@
[gd_resource type="Resource" script_class="CollectableResource" load_steps=2 format=3 uid="uid://b6apusc0jmi3x"]
[ext_resource type="Script" path="res://scripts/resources/collectable_resource.gd" id="1_2d5tb"]
[resource]
script = ExtResource("1_2d5tb")
amount = 1

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=33 format=4 uid="uid://h60obxmju6mo"]
[gd_scene load_steps=34 format=4 uid="uid://h60obxmju6mo"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_5lb42"]
[ext_resource type="TileSet" uid="uid://cl4bn8lofqvky" path="res://tileset/village/tileset_village.tres" id="1_d680t"]
@@ -20,6 +20,7 @@
[ext_resource type="PackedScene" uid="uid://dstko446qydsc" path="res://objects/cannon.tscn" id="11_qv64j"]
[ext_resource type="Script" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="13_rsy5s"]
[ext_resource type="Script" path="res://addons/phantom_camera/scripts/resources/tween_resource.gd" id="14_mjvn7"]
[ext_resource type="PackedScene" uid="uid://d0s2abysa86rq" path="res://objects/child.tscn" id="21_8rhdx"]
[sub_resource type="Gradient" id="Gradient_anvhr"]
offsets = PackedFloat32Array(1)
@@ -506,3 +507,6 @@ follow_target = NodePath("../Brick Player")
tween_resource = SubResource("Resource_lsjk3")
follow_damping = true
limit_target = NodePath("../Terrain Layer")
[node name="Child" parent="." instance=ExtResource("21_8rhdx")]
position = Vector2(880, -570)

View File

@@ -12,10 +12,8 @@ func _ready() -> void:
await get_tree().process_frame
if not lever:
var levers_nodes := get_tree().get_nodes_in_group("levers")
print("Found levers: ", levers_nodes)
for lever_node in levers_nodes:
var lever_component: LeverComponent = lever_node.get_node_or_null("LeverComponent")
print("Lever component: ", lever_component)
if lever_component:
lever_component.activated.connect(on_lever_activated)
else:
@@ -27,7 +25,6 @@ func _ready() -> void:
func on_lever_activated() -> void:
print("Lever activated, moving cage.")
var tween: Tween = create_tween()
var end_position: Vector2 = root.position + move_value
tween.tween_property(root, "position", end_position, tween_duration)

View File

@@ -6,6 +6,7 @@ var has_fade_away: bool = false
@export var area2d: Area2D
@export var collectable_data: CollectableResource
@export var sfx: AudioStreamPlayer2D
signal collected(amount: int)
@@ -24,5 +25,8 @@ func _ready() -> void:
func _on_area2d_body_entered(body: Node2D) -> void:
if body.has_node("CanPickUpComponent"):
collected.emit(collectable_data.amount)
if sfx:
sfx.play()
if not has_fade_away:
await sfx.finished
root.queue_free()

View File

@@ -3,17 +3,29 @@ extends Node
@export var health: float = 1.0
@export var max_health: float = 1.0
@export var hurt_fx: AudioStreamPlayer2D
@export var heal_fx: AudioStreamPlayer2D
signal on_health_change(delta: float, total_health: float)
signal on_death
func _get_delta(value: float) -> float:
var old_value = health
return value - old_value
func set_health(new_value: float):
var delta = _get_delta(new_value)
if sign(delta) > 0:
if heal_fx:
heal_fx.play()
elif sign(delta) < 0:
if hurt_fx:
hurt_fx.play()
await hurt_fx.finished
if new_value >= max_health:
health = max_health
on_health_change.emit(delta, health)
@@ -27,10 +39,14 @@ func set_health(new_value: float):
on_health_change.emit(delta, health)
func decrease_health(value: float):
var delta = _get_delta(value)
health -= value
if hurt_fx:
hurt_fx.play()
await hurt_fx.finished
if health <= 0:
on_death.emit()
@@ -38,6 +54,7 @@ func decrease_health(value: float):
on_health_change.emit(delta, health)
func increase_health(value: float):
var delta = _get_delta(value)
@@ -49,5 +66,7 @@ func increase_health(value: float):
return
health += value
if heal_fx:
heal_fx.play()
on_health_change.emit(delta, health)

View File

@@ -28,6 +28,8 @@ func _on_body_entered(body: Node2D) -> void:
if body is PlayerController:
handle_launchpad_animation()
body.velocity.y = -jump_force
if body.jump_sfx:
body.jump_sfx.play()
func handle_launchpad_animation() -> void:

View File

@@ -29,7 +29,6 @@ func _on_body_entered(body: Node2D) -> void:
func activate() -> void:
print("Lever activated.")
activated.emit()
sprite2d.frame = start_animation_index + 1
var timer := get_tree().create_timer(animation_duration)

View File

@@ -3,8 +3,8 @@ extends CharacterBody2D
@export var speed: float = 300.0
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var last_direction: Vector2 = Vector2.RIGHT
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var last_direction: Vector2 = Vector2.RIGHT
var previous_velocity: Vector2 = Vector2.ZERO
@onready var root = $Root
@@ -13,19 +13,21 @@ var previous_velocity: Vector2 = Vector2.ZERO
@export var jump_height: float = 100
@export var jump_time_to_peak: float = 0.5
@export var jump_time_to_descent: float = 0.4
@export var coyote_frames: int = 6
@export var coyote_mode: bool = false
@export var was_last_floor: bool = false
@export var jump_sfx: AudioStreamPlayer2D
@onready var jump_velocity: float = ((2.0 * jump_height) / jump_time_to_peak) * -1.0
@onready var jump_gravity: float = ((-2.0 * jump_height) / (jump_time_to_peak * jump_time_to_peak)) * -1.0
@onready var fall_gravity: float = ((-2.0 * jump_height) / (jump_time_to_descent * jump_time_to_descent)) * -1.0
func _ready() -> void:
coyote_timer.timeout.connect(on_coyote_timer_timeout)
coyote_timer.wait_time = coyote_frames / 60.0
func _process(_delta):
if velocity.x > 0.0:
root.rotation = deg_to_rad(-10)
@@ -34,13 +36,14 @@ func _process(_delta):
else:
root.rotation = 0
func _physics_process(delta):
if is_on_floor():
was_last_floor = true
coyote_mode = false # Reset coyote mode when back on the floor
coyote_timer.stop() # Stop timer when grounded
else:
if was_last_floor: # Start coyote timer only once
if was_last_floor: # Start coyote timer only once
coyote_mode = true
coyote_timer.start()
was_last_floor = false
@@ -66,13 +69,18 @@ func _physics_process(delta):
previous_velocity = velocity
move_and_slide()
func jump():
velocity.y = jump_velocity
coyote_mode = false
if jump_sfx:
jump_sfx.play()
func calculate_gravity() -> float:
return jump_gravity if velocity.y < 0.0 else fall_gravity
func on_coyote_timer_timeout():
coyote_mode = false

BIN
sfx/child_pickup.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://drfr0wlgkhkdq"
path="res://.godot/imported/child_pickup.wav-5809159f50b9d46e7e099b81ca166e24.sample"
[deps]
source_file="res://sfx/child_pickup.wav"
dest_files=["res://.godot/imported/child_pickup.wav-5809159f50b9d46e7e099b81ca166e24.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/enemy_hurt.wav Normal file

Binary file not shown.

24
sfx/enemy_hurt.wav.import Normal file
View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b3tsqhr06pbrs"
path="res://.godot/imported/enemy_hurt.wav-50b9e9bcd43d59b08ded3a73711340cb.sample"
[deps]
source_file="res://sfx/enemy_hurt.wav"
dest_files=["res://.godot/imported/enemy_hurt.wav-50b9e9bcd43d59b08ded3a73711340cb.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/explosion.wav Normal file

Binary file not shown.

24
sfx/explosion.wav.import Normal file
View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cmkc4huykx4oi"
path="res://.godot/imported/explosion.wav-865094309361083ba4c2c3e081b1f684.sample"
[deps]
source_file="res://sfx/explosion.wav"
dest_files=["res://.godot/imported/explosion.wav-865094309361083ba4c2c3e081b1f684.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/heal.wav Normal file

Binary file not shown.

24
sfx/heal.wav.import Normal file
View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://ycgtf6wj7mto"
path="res://.godot/imported/heal.wav-3855e10a97ba6061f054d1c1fad58a1c.sample"
[deps]
source_file="res://sfx/heal.wav"
dest_files=["res://.godot/imported/heal.wav-3855e10a97ba6061f054d1c1fad58a1c.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/jump.wav Normal file

Binary file not shown.

24
sfx/jump.wav.import Normal file
View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://duj2q0rqytaxg"
path="res://.godot/imported/jump.wav-86b04f40cc1820c332f6911b8abfc17a.sample"
[deps]
source_file="res://sfx/jump.wav"
dest_files=["res://.godot/imported/jump.wav-86b04f40cc1820c332f6911b8abfc17a.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/pickup_coin_1.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dpyr80hk4kebc"
path="res://.godot/imported/pickup_coin_1.wav-2e7c3166534ca699b4db8631df393007.sample"
[deps]
source_file="res://sfx/pickup_coin_1.wav"
dest_files=["res://.godot/imported/pickup_coin_1.wav-2e7c3166534ca699b4db8631df393007.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/pickup_coin_2.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bceic1csr8rq3"
path="res://.godot/imported/pickup_coin_2.wav-6e599ccffc19810710f47b6be4f50847.sample"
[deps]
source_file="res://sfx/pickup_coin_2.wav"
dest_files=["res://.godot/imported/pickup_coin_2.wav-6e599ccffc19810710f47b6be4f50847.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/pickup_coin_3.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://d2rj7uy5f0kwm"
path="res://.godot/imported/pickup_coin_3.wav-9ca83ce7791a21201edb3797ab0a1437.sample"
[deps]
source_file="res://sfx/pickup_coin_3.wav"
dest_files=["res://.godot/imported/pickup_coin_3.wav-9ca83ce7791a21201edb3797ab0a1437.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/pickup_coin_4.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://wr7n5ivv06ux"
path="res://.godot/imported/pickup_coin_4.wav-bc3c9ad917f3e4f2de8fb49beb8ba494.sample"
[deps]
source_file="res://sfx/pickup_coin_4.wav"
dest_files=["res://.godot/imported/pickup_coin_4.wav-bc3c9ad917f3e4f2de8fb49beb8ba494.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/player_hurt.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bmfn6p88gy575"
path="res://.godot/imported/player_hurt.wav-726edd1f516b3964ec0104c57edafe2a.sample"
[deps]
source_file="res://sfx/player_hurt.wav"
dest_files=["res://.godot/imported/player_hurt.wav-726edd1f516b3964ec0104c57edafe2a.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sfx/shoot.wav Normal file

Binary file not shown.

24
sfx/shoot.wav.import Normal file
View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dyev46uqusimi"
path="res://.godot/imported/shoot.wav-b280d0cd8488ec3282e3daa20e9276c8.sample"
[deps]
source_file="res://sfx/shoot.wav"
dest_files=["res://.godot/imported/shoot.wav-b280d0cd8488ec3282e3daa20e9276c8.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
sprites/lollipop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://8h05rd26t66q"
path="res://.godot/imported/lollipop.png-6ab4585a465de5b2d8932d778919698d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/lollipop.png"
dest_files=["res://.godot/imported/lollipop.png-6ab4585a465de5b2d8932d778919698d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1