added hit sfx with random pitch on-hit
parent
3dc9c78f77
commit
b7a3934daf
|
|
@ -4,36 +4,20 @@
|
||||||
[ext_resource type="Script" uid="uid://cphrdy0xexx30" path="res://scenes/game.gd" id="1_vtaks"]
|
[ext_resource type="Script" uid="uid://cphrdy0xexx30" path="res://scenes/game.gd" id="1_vtaks"]
|
||||||
[ext_resource type="PackedScene" uid="uid://7vohdw0xop0g" path="res://scenes/worldborder.tscn" id="2_dinhu"]
|
[ext_resource type="PackedScene" uid="uid://7vohdw0xop0g" path="res://scenes/worldborder.tscn" id="2_dinhu"]
|
||||||
[ext_resource type="Script" uid="uid://coplu13jpw4xq" path="res://scripts/camera_2d.gd" id="3_kvpfn"]
|
[ext_resource type="Script" uid="uid://coplu13jpw4xq" path="res://scripts/camera_2d.gd" id="3_kvpfn"]
|
||||||
[ext_resource type="Script" uid="uid://b4jrogrq54c8f" path="res://scripts/SpawnEntry.gd" id="6_ir15t"]
|
|
||||||
[ext_resource type="Script" uid="uid://dovkm6w8af08x" path="res://scripts/spawn_control.gd" id="6_p57ef"]
|
[ext_resource type="Script" uid="uid://dovkm6w8af08x" path="res://scripts/spawn_control.gd" id="6_p57ef"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ccotbw7gepsge" path="res://scenes/slime.tscn" id="7_ca42v"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://c4i3fnr6gpjp" path="res://assets/tileset/Tiled_files/details.png" id="7_gee14"]
|
[ext_resource type="Texture2D" uid="uid://c4i3fnr6gpjp" path="res://assets/tileset/Tiled_files/details.png" id="7_gee14"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b4v0ntaukg2je" path="res://scenes/witch.tscn" id="7_u5sy4"]
|
[ext_resource type="PackedScene" uid="uid://b4v0ntaukg2je" path="res://scenes/witch.tscn" id="7_u5sy4"]
|
||||||
[ext_resource type="Texture2D" uid="uid://0xu8ohipv2mj" path="res://assets/tileset/Tiled_files/Objects.png" id="8_0tnpc"]
|
[ext_resource type="Texture2D" uid="uid://0xu8ohipv2mj" path="res://assets/tileset/Tiled_files/Objects.png" id="8_0tnpc"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cj83ht5o2l8c1" path="res://scenes/blue_slime.tscn" id="8_rysoc"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cgu7w2jd42f3a" path="res://scenes/tile_map_layer(background).tscn" id="8_vtaks"]
|
[ext_resource type="PackedScene" uid="uid://cgu7w2jd42f3a" path="res://scenes/tile_map_layer(background).tscn" id="8_vtaks"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bgpsc6dvsn7ak" path="res://scenes/tile_map_layer(objects).tscn" id="9_kvpfn"]
|
[ext_resource type="PackedScene" uid="uid://bgpsc6dvsn7ak" path="res://scenes/tile_map_layer(objects).tscn" id="9_kvpfn"]
|
||||||
[ext_resource type="PackedScene" uid="uid://co8t1fr3b3kub" path="res://scenes/tile_map_layer(overlay).tscn" id="10_dinhu"]
|
[ext_resource type="PackedScene" uid="uid://co8t1fr3b3kub" path="res://scenes/tile_map_layer(overlay).tscn" id="10_dinhu"]
|
||||||
[ext_resource type="Script" uid="uid://ckv6prbe1o7s1" path="res://scripts/drop_manager.gd" id="10_vtaks"]
|
[ext_resource type="Script" uid="uid://ckv6prbe1o7s1" path="res://scripts/drop_manager.gd" id="10_vtaks"]
|
||||||
[ext_resource type="Script" uid="uid://pmmc7tivuuo4" path="res://scripts/perk_effects.gd" id="16_ca42v"]
|
[ext_resource type="Script" uid="uid://pmmc7tivuuo4" path="res://scripts/perk_effects.gd" id="16_ca42v"]
|
||||||
[ext_resource type="Script" uid="uid://dm1sntwjrv3vl" path="res://scripts/level_up_manager.gd" id="16_rysoc"]
|
[ext_resource type="Script" uid="uid://dm1sntwjrv3vl" path="res://scripts/level_up_manager.gd" id="16_rysoc"]
|
||||||
[ext_resource type="Script" uid="uid://duauc778wc3hd" path="res://scripts/pause_menu.gd" id="18_264po"]
|
|
||||||
[ext_resource type="FontFile" uid="uid://8v71dcws4q6o" path="res://assets/fonts/slkscre.ttf" id="19_1kice"]
|
|
||||||
[ext_resource type="Script" uid="uid://586y330mhx8" path="res://scripts/options_menu_ingame.gd" id="20_1kice"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dp8o40ssuh8ip" path="res://assets/Tiny RPG Mana Soul GUI v1.0/20250421barB-Sheet.png" id="16_ssvqc"]
|
[ext_resource type="Texture2D" uid="uid://dp8o40ssuh8ip" path="res://assets/Tiny RPG Mana Soul GUI v1.0/20250421barB-Sheet.png" id="16_ssvqc"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/pause_menu.gd" id="18_264po"]
|
||||||
[sub_resource type="Resource" id="Resource_ssvqc"]
|
[ext_resource type="FontFile" uid="uid://8v71dcws4q6o" path="res://assets/fonts/slkscre.ttf" id="19_1kice"]
|
||||||
script = ExtResource("6_ir15t")
|
[ext_resource type="Script" path="res://scripts/options_menu_ingame.gd" id="20_1kice"]
|
||||||
weight = 1.0
|
|
||||||
enemy = ExtResource("7_ca42v")
|
|
||||||
metadata/_custom_type_script = "uid://b4jrogrq54c8f"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_264po"]
|
|
||||||
script = ExtResource("6_ir15t")
|
|
||||||
min_time = 10.0
|
|
||||||
weight = 0.5
|
|
||||||
enemy = ExtResource("8_rysoc")
|
|
||||||
metadata/_custom_type_script = "uid://b4jrogrq54c8f"
|
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_vtaks"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_vtaks"]
|
||||||
texture = ExtResource("7_gee14")
|
texture = ExtResource("7_gee14")
|
||||||
|
|
@ -2445,14 +2429,14 @@ offset_top = 31.0
|
||||||
offset_right = 60.0
|
offset_right = 60.0
|
||||||
offset_bottom = 55.0
|
offset_bottom = 55.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
text = "00:00"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
theme_override_fonts/font = ExtResource("19_1kice")
|
|
||||||
theme_override_font_sizes/font_size = 20
|
|
||||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||||
theme_override_constants/shadow_offset_x = 1
|
theme_override_constants/shadow_offset_x = 1
|
||||||
theme_override_constants/shadow_offset_y = 1
|
theme_override_constants/shadow_offset_y = 1
|
||||||
|
theme_override_fonts/font = ExtResource("19_1kice")
|
||||||
|
theme_override_font_sizes/font_size = 20
|
||||||
|
text = "00:00"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
[node name="LevelUpManager" type="Control" parent="CanvasLayer" unique_id=292400493]
|
[node name="LevelUpManager" type="Control" parent="CanvasLayer" unique_id=292400493]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
|
|
|
||||||
|
|
@ -48,15 +48,19 @@ func die():
|
||||||
death_anim = "death_up" if last_direction.y < 0 else "death_down"
|
death_anim = "death_up" if last_direction.y < 0 else "death_down"
|
||||||
animated_sprite_2d.sprite_frames.set_animation_loop(death_anim, false)
|
animated_sprite_2d.sprite_frames.set_animation_loop(death_anim, false)
|
||||||
animated_sprite_2d.play(death_anim)
|
animated_sprite_2d.play(death_anim)
|
||||||
var player = AudioStreamPlayer.new()
|
_play_hit_sound()
|
||||||
add_child(player)
|
|
||||||
player.stream = death_sound
|
|
||||||
player.bus = "SFX"
|
|
||||||
player.play()
|
|
||||||
died.emit(self)
|
died.emit(self)
|
||||||
await animated_sprite_2d.animation_finished
|
await animated_sprite_2d.animation_finished
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
|
func _play_hit_sound() -> void:
|
||||||
|
var ap = AudioStreamPlayer.new()
|
||||||
|
add_child(ap)
|
||||||
|
ap.stream = death_sound
|
||||||
|
ap.bus = "SFX"
|
||||||
|
ap.pitch_scale = randf_range(0.7, 1.3)
|
||||||
|
ap.play()
|
||||||
|
|
||||||
func take_damage(amount: int) -> void:
|
func take_damage(amount: int) -> void:
|
||||||
if is_dying or is_hurt:
|
if is_dying or is_hurt:
|
||||||
return
|
return
|
||||||
|
|
@ -78,6 +82,7 @@ func _play_hurt() -> void:
|
||||||
if not animated_sprite_2d.sprite_frames.has_animation(hurt_anim):
|
if not animated_sprite_2d.sprite_frames.has_animation(hurt_anim):
|
||||||
return
|
return
|
||||||
is_hurt = true
|
is_hurt = true
|
||||||
|
_play_hit_sound()
|
||||||
animated_sprite_2d.sprite_frames.set_animation_loop(hurt_anim, false)
|
animated_sprite_2d.sprite_frames.set_animation_loop(hurt_anim, false)
|
||||||
animated_sprite_2d.play(hurt_anim)
|
animated_sprite_2d.play(hurt_anim)
|
||||||
await get_tree().create_timer(0.25, true).timeout
|
await get_tree().create_timer(0.25, true).timeout
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue