Add All Sounds, Remove Pause Button, Fix DMG Labels

main
Luna Brovchuk 2023-10-03 00:45:13 +02:00
parent 73cdf2aa18
commit c20248f972
17 changed files with 106 additions and 44 deletions

Binary file not shown.

View File

@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/click.ogg-e732bdf51bab86686b8315af4588904e.oggstr"
[deps]
source_file="res://res/sounds/card_select/click.ogg"
dest_files=[ "res://.import/click.ogg-e732bdf51bab86686b8315af4588904e.oggstr" ]
[params]
loop=false
loop_offset=0

Binary file not shown.

View File

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/stunned.wav-e890fd6bba7c129a0f11a2fe38b930e6.sample"
[deps]
source_file="res://res/sounds/player/stunned.wav"
dest_files=[ "res://.import/stunned.wav-e890fd6bba7c129a0f11a2fe38b930e6.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

View File

@ -53,10 +53,8 @@ func area_entered(area):
var dmg_label = dmg_label_preload.instance() var dmg_label = dmg_label_preload.instance()
dmg_label.dmg = damage * damage_multiplier dmg_label.dmg = damage * damage_multiplier
if poison_damage != 0:
dmg_label.modulate = Color("1E6945")
if target_center != null: if target_center != null:
dmg_label.global_position = target_center + Vector2(-16, -16) dmg_label.global_position = target_center
get_parent().add_child(dmg_label) get_parent().add_child(dmg_label)
if not explode and explosive_damage != 0: if not explode and explosive_damage != 0:
explode = true explode = true

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=4 format=2]
[ext_resource path="res://src/models/card/sprites/cards_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/card/sprites/cards_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://res/sounds/card_select/card_select.ogg" type="AudioStream" id=2]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 47, 51.5 ) extents = Vector2( 47, 51.5 )
@ -16,3 +17,7 @@ centered = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 47, 51.5 ) position = Vector2( 47, 51.5 )
shape = SubResource( 1 ) shape = SubResource( 1 )
[node name="AudioHover" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 2 )
volume_db = -15.0

View File

@ -28,7 +28,7 @@ flip_h = true
use_parent_material = true use_parent_material = true
frames = ExtResource( 1 ) frames = ExtResource( 1 )
animation = "idle" animation = "idle"
frame = 1 frame = 4
playing = true playing = true
centered = false centered = false

View File

@ -9,7 +9,7 @@ var dashing = false
func _ready(): func _ready():
self.global_position.x = ([-1, 1][randi()%2] * 320) + randi()%120 + 50 self.global_position.x = ([-1, 1][randi()%2] * 320) + randi()%120 + 50
self.global_position.y = ([-1, 1][randi()%2] * 180) + randi()%40 + 20 self.global_position.y = ([-1, 1][randi()%2] * 180) + randi()%40 + 20
hp = 8 hp = 11
func _physics_process(delta): func _physics_process(delta):
if Global.playing: if Global.playing:
@ -26,9 +26,11 @@ func _physics_process(delta):
$Aim.frame = 0 $Aim.frame = 0
$Aim.play("idle") $Aim.play("idle")
dash_target = global_position + Vector2(60, 0).rotated(angle) dash_target = global_position + Vector2(60, 0).rotated(angle)
$AudioDashCharge.play()
if dash_target != Vector2.ZERO: if dash_target != Vector2.ZERO:
dash_timer += delta dash_timer += delta
if dash_timer >= 1.0: if dash_timer >= 1.0:
$AudioDash.play()
$Aim.visible = false $Aim.visible = false
dash_timer = 0 dash_timer = 0
dashing = true dashing = true

View File

@ -1,7 +1,9 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://src/models/enemies/trash_can/sprites/trash_can_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/enemies/trash_can/sprites/trash_can_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/enemies/trash_can/trash_can.gd" type="Script" id=2] [ext_resource path="res://src/models/enemies/trash_can/trash_can.gd" type="Script" id=2]
[ext_resource path="res://res/sounds/trash/rolling_loop_2_sec.wav" type="AudioStream" id=3]
[ext_resource path="res://res/sounds/trash/charge.wav" type="AudioStream" id=4]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 5.5, 7 ) extents = Vector2( 5.5, 7 )
@ -28,5 +30,13 @@ wait_time = 0.5
one_shot = true one_shot = true
autostart = true autostart = true
[node name="ChargeSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 )
volume_db = -15.0
[node name="RollLoop" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 3 )
volume_db = -20.0
[connection signal="animation_finished" from="Sprite" to="." method="_on_sprite_animation_finished"] [connection signal="animation_finished" from="Sprite" to="." method="_on_sprite_animation_finished"]
[connection signal="timeout" from="Spawn_Animation_Start" to="." method="_on_Spawn_Animation_Start_timeout"] [connection signal="timeout" from="Spawn_Animation_Start" to="." method="_on_Spawn_Animation_Start_timeout"]

View File

@ -56,6 +56,7 @@ func _ready():
path_sprite.connect("animation_finished", self, "delete_path_sprite") path_sprite.connect("animation_finished", self, "delete_path_sprite")
path_sprite.frame = 0 path_sprite.frame = 0
path_sprite.play("default") path_sprite.play("default")
$ChargeSound.play()
func drop_trash(): func drop_trash():
var trash_drop = drop_preload.instance() var trash_drop = drop_preload.instance()
@ -92,6 +93,8 @@ func _physics_process(delta):
drop_trash() drop_trash()
if start_timer >= 1.25: if start_timer >= 1.25:
if not $RollLoop.playing:
$RollLoop.play()
velocity = move_and_slide(velocity) velocity = move_and_slide(velocity)
func _on_sprite_animation_finished(): func _on_sprite_animation_finished():

View File

@ -28,7 +28,7 @@ func area_entered(area):
dmg_label.dmg = damage dmg_label.dmg = damage
dmg_label.modulate = Color("F26038") dmg_label.modulate = Color("F26038")
if target_center != null: if target_center != null:
dmg_label.global_position = target_center + Vector2(-16, -16) dmg_label.global_position = target_center
get_parent().add_child(dmg_label) get_parent().add_child(dmg_label)
parent.deal_damage(damage) parent.deal_damage(damage)
call_deferred("free") call_deferred("free")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=2] [gd_scene load_steps=14 format=2]
[ext_resource path="res://src/models/player/sprites/player_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/player/sprites/player_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/player/player.gd" type="Script" id=2] [ext_resource path="res://src/models/player/player.gd" type="Script" id=2]
@ -6,6 +6,9 @@
[ext_resource path="res://src/models/shadow/shadow.png" type="Texture" id=4] [ext_resource path="res://src/models/shadow/shadow.png" type="Texture" id=4]
[ext_resource path="res://src/models/player/stars/stars_spriteframes.tres" type="SpriteFrames" id=5] [ext_resource path="res://src/models/player/stars/stars_spriteframes.tres" type="SpriteFrames" id=5]
[ext_resource path="res://res/sounds/player/damaged.wav" type="AudioStream" id=6] [ext_resource path="res://res/sounds/player/damaged.wav" type="AudioStream" id=6]
[ext_resource path="res://res/sounds/player/spell/release.wav" type="AudioStream" id=7]
[ext_resource path="res://res/sounds/player/spell/cast 2sec.wav" type="AudioStream" id=8]
[ext_resource path="res://res/sounds/player/stunned.wav" type="AudioStream" id=9]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 3.5, 3.5 ) extents = Vector2( 3.5, 3.5 )
@ -129,5 +132,18 @@ playing = true
[node name="AudioGetDamage" type="AudioStreamPlayer" parent="."] [node name="AudioGetDamage" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 ) stream = ExtResource( 6 )
volume_db = -15.0
[node name="AudioCast" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 8 )
volume_db = -18.0
[node name="AudioRelease" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 7 )
volume_db = -18.0
[node name="AudioStunned" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 9 )
volume_db = -15.0
[connection signal="area_entered" from="EnemyCollision" to="." method="area_entered"] [connection signal="area_entered" from="EnemyCollision" to="." method="area_entered"]

View File

@ -72,6 +72,7 @@ func area_entered(area):
get_tree().get_root().get_node("Game/View/Camera2D").current = true get_tree().get_root().get_node("Game/View/Camera2D").current = true
if is_instance_valid(parent) and parent.is_in_group("sonic_wave") and not stunned and not invincible: if is_instance_valid(parent) and parent.is_in_group("sonic_wave") and not stunned and not invincible:
stunned = true stunned = true
$AudioStunned.play()
$Stars.visible = true $Stars.visible = true
stunned_timer = .0 stunned_timer = .0
recharge_timer = .0 recharge_timer = .0
@ -205,6 +206,10 @@ func _physics_process(delta):
if not stunned: if not stunned:
if recharge_timer <= get_recharge(): if recharge_timer <= get_recharge():
recharge_timer += delta recharge_timer += delta
if not $AudioCast.playing:
$AudioCast.play()
else:
$AudioCast.playing = false
velocity = move_and_slide(velocity * speed_multiplier) velocity = move_and_slide(velocity * speed_multiplier)
else: else:
$Sprite.playing = false $Sprite.playing = false
@ -214,6 +219,7 @@ func _physics_process(delta):
if Global.playing and target != null and is_instance_valid(target) and not target.dead: if Global.playing and target != null and is_instance_valid(target) and not target.dead:
target.material = outline_material target.material = outline_material
if recharge_timer >= get_recharge(): if recharge_timer >= get_recharge():
$AudioRelease.play()
_shoot() _shoot()
recharge_timer = .0 recharge_timer = .0

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=26 format=2] [gd_scene load_steps=24 format=2]
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1] [ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2] [ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
@ -8,13 +8,12 @@
[ext_resource path="res://src/scenes/game/sprites/health/health_spriteframes.tres" type="SpriteFrames" id=6] [ext_resource path="res://src/scenes/game/sprites/health/health_spriteframes.tres" type="SpriteFrames" id=6]
[ext_resource path="res://src/scenes/game/sprites/cast_time.png" type="Texture" id=7] [ext_resource path="res://src/scenes/game/sprites/cast_time.png" type="Texture" id=7]
[ext_resource path="res://src/scenes/game/card_placeholder.gd" type="Script" id=8] [ext_resource path="res://src/scenes/game/card_placeholder.gd" type="Script" id=8]
[ext_resource path="res://res/sounds/card_select/card_select.ogg" type="AudioStream" id=9] [ext_resource path="res://res/sounds/card_select/click.ogg" type="AudioStream" id=9]
[ext_resource path="res://src/scenes/game/sprites/player_icon.png" type="Texture" id=10] [ext_resource path="res://src/scenes/game/sprites/player_icon.png" type="Texture" id=10]
[ext_resource path="res://src/scenes/game/game.gd" type="Script" id=11] [ext_resource path="res://src/scenes/game/game.gd" type="Script" id=11]
[ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12] [ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12]
[ext_resource path="res://src/scenes/game/sprites/hatch1.png" type="Texture" id=13] [ext_resource path="res://src/scenes/game/sprites/hatch1.png" type="Texture" id=13]
[ext_resource path="res://src/scenes/game/sprites/hatch2.png" type="Texture" id=14] [ext_resource path="res://src/scenes/game/sprites/hatch2.png" type="Texture" id=14]
[ext_resource path="res://src/models/enemies/rat/Rat.tscn" type="PackedScene" id=15]
[ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16] [ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16]
[ext_resource path="res://src/scenes/game/sprites/stun/stun_spriteframes.tres" type="SpriteFrames" id=17] [ext_resource path="res://src/scenes/game/sprites/stun/stun_spriteframes.tres" type="SpriteFrames" id=17]
[ext_resource path="res://src/models/card/Card.tscn" type="PackedScene" id=18] [ext_resource path="res://src/models/card/Card.tscn" type="PackedScene" id=18]
@ -22,7 +21,6 @@
[ext_resource path="res://src/scenes/game/camera.gd" type="Script" id=20] [ext_resource path="res://src/scenes/game/camera.gd" type="Script" id=20]
[ext_resource path="res://src/scenes/game/sprites/shake_border.png" type="Texture" id=21] [ext_resource path="res://src/scenes/game/sprites/shake_border.png" type="Texture" id=21]
[ext_resource path="res://src/scenes/game/sprites/damage.png" type="Texture" id=22] [ext_resource path="res://src/scenes/game/sprites/damage.png" type="Texture" id=22]
[ext_resource path="res://src/scenes/game/sprites/pause.png" type="Texture" id=23]
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 10, 60 ) extents = Vector2( 10, 60 )
@ -83,17 +81,11 @@ position = Vector2( 33, 50 )
texture = ExtResource( 14 ) texture = ExtResource( 14 )
[node name="Player" parent="View" instance=ExtResource( 5 )] [node name="Player" parent="View" instance=ExtResource( 5 )]
position = Vector2( 46, 42 ) position = Vector2( 128, 54 )
z_index = 1 z_index = 1
[node name="Enemies" type="Node2D" parent="View"] [node name="Enemies" type="Node2D" parent="View"]
[node name="Rat" parent="View/Enemies" instance=ExtResource( 15 )]
position = Vector2( 237, 32 )
[node name="Rat3" parent="View/Enemies" instance=ExtResource( 15 )]
position = Vector2( 183, 36 )
[node name="CPUParticles2D" type="CPUParticles2D" parent="View"] [node name="CPUParticles2D" type="CPUParticles2D" parent="View"]
position = Vector2( 160, 90 ) position = Vector2( 160, 90 )
amount = 9 amount = 9
@ -265,16 +257,6 @@ margin_bottom = 167.0
theme = ExtResource( 4 ) theme = ExtResource( 4 )
text = "15" text = "15"
[node name="Pause" type="Button" parent="UIWrapper/UI/Right"]
margin_left = 272.0
margin_top = 143.0
margin_right = 298.0
margin_bottom = 163.0
toggle_mode = true
icon = ExtResource( 23 )
flat = true
icon_align = 1
[node name="Cards" type="Control" parent="UIWrapper/UI"] [node name="Cards" type="Control" parent="UIWrapper/UI"]
visible = false visible = false
margin_right = 320.0 margin_right = 320.0
@ -291,9 +273,6 @@ script = ExtResource( 8 )
[node name="Card" parent="UIWrapper/UI/Cards/LeftPlaceholder" instance=ExtResource( 18 )] [node name="Card" parent="UIWrapper/UI/Cards/LeftPlaceholder" instance=ExtResource( 18 )]
[node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/LeftPlaceholder"]
stream = ExtResource( 9 )
[node name="CenterPlaceholder" type="Control" parent="UIWrapper/UI/Cards" groups=["card_placeholder"]] [node name="CenterPlaceholder" type="Control" parent="UIWrapper/UI/Cards" groups=["card_placeholder"]]
margin_left = 113.0 margin_left = 113.0
margin_top = 8.0 margin_top = 8.0
@ -305,9 +284,6 @@ id = 1
[node name="Card" parent="UIWrapper/UI/Cards/CenterPlaceholder" instance=ExtResource( 18 )] [node name="Card" parent="UIWrapper/UI/Cards/CenterPlaceholder" instance=ExtResource( 18 )]
[node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/CenterPlaceholder"]
stream = ExtResource( 9 )
[node name="RightPlaceholder" type="Control" parent="UIWrapper/UI/Cards" groups=["card_placeholder"]] [node name="RightPlaceholder" type="Control" parent="UIWrapper/UI/Cards" groups=["card_placeholder"]]
margin_left = 218.0 margin_left = 218.0
margin_top = 8.0 margin_top = 8.0
@ -319,7 +295,6 @@ id = 2
[node name="Card" parent="UIWrapper/UI/Cards/RightPlaceholder" instance=ExtResource( 18 )] [node name="Card" parent="UIWrapper/UI/Cards/RightPlaceholder" instance=ExtResource( 18 )]
[node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/RightPlaceholder"] [node name="AudioClick" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards"]
stream = ExtResource( 9 ) stream = ExtResource( 9 )
volume_db = -15.0
[connection signal="pressed" from="UIWrapper/UI/Right/Pause" to="." method="pause_pressed"]

View File

@ -16,5 +16,5 @@ func _ready():
func select_hover(node): func select_hover(node):
game.selected_card = id game.selected_card = id
game.selected_modifier = $Card.frame game.selected_modifier = $Card.frame
$AudioCardSelect.play() $Card/AudioHover.play()

View File

@ -26,7 +26,7 @@ var spells = [
func _ready(): func _ready():
Global.playing = true Global.playing = true
Global.play_time = 300 Global.play_time = .0
Global.health = 5 Global.health = 5
Global.add_health(0) Global.add_health(0)
@ -53,6 +53,7 @@ func _physics_process(delta):
if child.is_in_group("card_placeholder"): if child.is_in_group("card_placeholder"):
child.get_node("Card").frame = cards.pop_at(randi()%cards.size()) child.get_node("Card").frame = cards.pop_at(randi()%cards.size())
$UIWrapper/UI/Cards.visible = true $UIWrapper/UI/Cards.visible = true
#$UIWrapper/UI/Right/Pause.visible = false
$UIWrapper/UI/LevelProgressBar/ColorRect.rect_size.x = (Global.play_time - difficulty * 60) / 60.0 * 300 $UIWrapper/UI/LevelProgressBar/ColorRect.rect_size.x = (Global.play_time - difficulty * 60) / 60.0 * 300
@ -67,9 +68,12 @@ func _physics_process(delta):
func select_card(): func select_card():
if selected_card != null: if selected_card != null:
selected_card = null
$UIWrapper/UI/Center/SpellHolder.add_modifier(spells[selected_modifier], selected_modifier) $UIWrapper/UI/Center/SpellHolder.add_modifier(spells[selected_modifier], selected_modifier)
Global.playing = true Global.playing = true
$UIWrapper/UI/Cards/AudioClick.play()
$UIWrapper/UI/Cards.visible = false $UIWrapper/UI/Cards.visible = false
#$UIWrapper/UI/Right/Pause.visible = true
func _process(delta): func _process(delta):
update_ui() update_ui()
@ -79,7 +83,7 @@ func update_ui():
$UIWrapper/UI/Right/CastTime/CastTimeLabel.text = String(player.get_recharge()) $UIWrapper/UI/Right/CastTime/CastTimeLabel.text = String(player.get_recharge())
$UIWrapper/UI/Right/Damage/DamageLabel.text = String(player.get_damage()) $UIWrapper/UI/Right/Damage/DamageLabel.text = String(player.get_damage())
$UIWrapper/UI/Left/LevelLabel.text = String(difficulty + 1) $UIWrapper/UI/Left/LevelLabel.text = String(difficulty + 1)
$UIWrapper/UI/Right/Pause.pressed = Global.playing #$UIWrapper/UI/Right/Pause.pressed = Global.playing
func pause_pressed(): func pause_pressed():
Global.playing = !Global.playing Global.playing = !Global.playing

View File

@ -1,6 +1,7 @@
extends KinematicBody2D extends KinematicBody2D
onready var player = $"../../Player" onready var player = $"../../Player"
var dmg_label_preload = preload("res://src/models/dmg_label/DMGLabel.tscn")
var empty_material = load("res://res/shaders/empty_material.tres") var empty_material = load("res://res/shaders/empty_material.tres")
var hp var hp
var dead = false var dead = false
@ -15,7 +16,6 @@ var poisoned_time = 3
var poisoned_damage_timer = .0 var poisoned_damage_timer = .0
var death_position var death_position
func deal_damage(amount): func deal_damage(amount):
hp -= amount hp -= amount
$AudioDamage.play() $AudioDamage.play()
@ -47,7 +47,7 @@ func _physics_process(delta):
if dead_timer >= 0.5: if dead_timer >= 0.5:
self.call_deferred("free") self.call_deferred("free")
if poison_damage != 0: if poison_damage != 0 and not dead:
poisoned_timer += delta poisoned_timer += delta
poisoned_damage_timer += delta poisoned_damage_timer += delta
if poisoned_timer >= poisoned_time: if poisoned_timer >= poisoned_time:
@ -55,6 +55,11 @@ func _physics_process(delta):
poisoned_damage_timer = .0 poisoned_damage_timer = .0
poison_damage = 0 poison_damage = 0
if poisoned_damage_timer >= 1: if poisoned_damage_timer >= 1:
var dmg_label = dmg_label_preload.instance()
dmg_label.dmg = poison_damage
dmg_label.modulate = Color("1E6945")
dmg_label.global_position = self.global_position
get_parent().add_child(dmg_label)
deal_damage(poison_damage) deal_damage(poison_damage)
poisoned_damage_timer = 0 poisoned_damage_timer = 0