diff --git a/Player/Player.tscn b/Player/Player.tscn index ea15a52..147490b 100644 --- a/Player/Player.tscn +++ b/Player/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=2] +[gd_scene load_steps=15 format=2] [ext_resource path="res://script/player.gd" type="Script" id=1] [ext_resource path="res://ui/PlayerStats.tscn" type="PackedScene" id=2] @@ -9,7 +9,6 @@ [ext_resource path="res://script/WandPosition.gd" type="Script" id=7] [ext_resource path="res://art/Paralax Dungeon.png" type="Texture" id=8] [ext_resource path="res://Sound Effects/Enemy Hit.wav" type="AudioStream" id=9] -[ext_resource path="res://Sound Effects/Enemy Hit Wall.wav" type="AudioStream" id=10] [sub_resource type="OccluderPolygon2D" id=1] polygon = PoolVector2Array( -7, 0, -7, -2, -6, -2, -6, -3, -5, -3, -5, -5, -6, -5, -6, -10, -7, -10, -7, -12, -6, -12, -6, -19, -4, -19, -4, -18, -3, -18, -3, -17, 1, -17, 1, -16, 3, -16, 3, -15, 4, -15, 4, -14, 5, -14, 5, -13, 6, -13, 6, -12, 7, -12, 7, -10, 6, -10, 6, -9, 5, -9, 5, -8, 6, -8, 6, -4, 5, -4, 5, 0, -7, 0 ) @@ -137,10 +136,6 @@ motion_mirroring = Vector2( 32, 32 ) position = Vector2( 192, 90 ) texture = ExtResource( 8 ) -[node name="Enemy Hit" type="AudioStreamPlayer" parent="."] +[node name="Enemy Hit" type="AudioStreamPlayer2D" parent="."] stream = ExtResource( 9 ) volume_db = -8.077 - -[node name="Enemy Hit Wall" type="AudioStreamPlayer" parent="."] -stream = ExtResource( 10 ) -volume_db = -7.068 diff --git a/Sound Effects/EcoProjectile.wav b/Sound Effects/EcoProjectile.wav new file mode 100644 index 0000000..2eebead Binary files /dev/null and b/Sound Effects/EcoProjectile.wav differ diff --git a/Sound Effects/EcoProjectile.wav.import b/Sound Effects/EcoProjectile.wav.import new file mode 100644 index 0000000..43d9bcc --- /dev/null +++ b/Sound Effects/EcoProjectile.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/EcoProjectile.wav-adf6ca7b1efe86f9224b520f8e67f8fc.sample" + +[deps] + +source_file="res://Sound Effects/EcoProjectile.wav" +dest_files=[ "res://.import/EcoProjectile.wav-adf6ca7b1efe86f9224b520f8e67f8fc.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=false +compress/mode=0 diff --git a/Sound Effects/Explosion.wav b/Sound Effects/Explosion.wav new file mode 100644 index 0000000..4cc46ce Binary files /dev/null and b/Sound Effects/Explosion.wav differ diff --git a/Sound Effects/Explosion.wav.import b/Sound Effects/Explosion.wav.import new file mode 100644 index 0000000..4fa1056 --- /dev/null +++ b/Sound Effects/Explosion.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Explosion.wav-5cb7c7f5343de2981f7d05530a959d2d.sample" + +[deps] + +source_file="res://Sound Effects/Explosion.wav" +dest_files=[ "res://.import/Explosion.wav-5cb7c7f5343de2981f7d05530a959d2d.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=false +compress/mode=0 diff --git a/Sound Effects/LogansHurt.wav b/Sound Effects/LogansHurt.wav new file mode 100644 index 0000000..8cfd338 Binary files /dev/null and b/Sound Effects/LogansHurt.wav differ diff --git a/Sound Effects/LogansHurt.wav.import b/Sound Effects/LogansHurt.wav.import new file mode 100644 index 0000000..b6178e2 --- /dev/null +++ b/Sound Effects/LogansHurt.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/LogansHurt.wav-fd9c54d42eb52d631999dcd57bb5eaec.sample" + +[deps] + +source_file="res://Sound Effects/LogansHurt.wav" +dest_files=[ "res://.import/LogansHurt.wav-fd9c54d42eb52d631999dcd57bb5eaec.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=false +compress/mode=0 diff --git a/Sound Effects/PhantomProjectile.wav b/Sound Effects/PhantomProjectile.wav new file mode 100644 index 0000000..bb87678 Binary files /dev/null and b/Sound Effects/PhantomProjectile.wav differ diff --git a/Sound Effects/PhantomProjectile.wav.import b/Sound Effects/PhantomProjectile.wav.import new file mode 100644 index 0000000..93f8615 --- /dev/null +++ b/Sound Effects/PhantomProjectile.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/PhantomProjectile.wav-f257a09b898285791c8dc71decddc4ca.sample" + +[deps] + +source_file="res://Sound Effects/PhantomProjectile.wav" +dest_files=[ "res://.import/PhantomProjectile.wav-f257a09b898285791c8dc71decddc4ca.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=false +compress/mode=0 diff --git a/Sound Effects/WaveProjectile.wav b/Sound Effects/WaveProjectile.wav new file mode 100644 index 0000000..52a783e Binary files /dev/null and b/Sound Effects/WaveProjectile.wav differ diff --git a/Sound Effects/WaveProjectile.wav.import b/Sound Effects/WaveProjectile.wav.import new file mode 100644 index 0000000..ddc6742 --- /dev/null +++ b/Sound Effects/WaveProjectile.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/WaveProjectile.wav-b9a0955442dfa8c13f48591adcf134a0.sample" + +[deps] + +source_file="res://Sound Effects/WaveProjectile.wav" +dest_files=[ "res://.import/WaveProjectile.wav-b9a0955442dfa8c13f48591adcf134a0.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=false +compress/mode=0 diff --git a/ai/ogre.tscn b/ai/ogre.tscn index 814ce84..a6b6b8f 100644 --- a/ai/ogre.tscn +++ b/ai/ogre.tscn @@ -8,7 +8,7 @@ [sub_resource type="CapsuleShape2D" id=1] height = 4.0 -[sub_resource type="CapsuleShape2D" id=3] +[sub_resource type="CapsuleShape2D" id=2] radius = 12.0 height = 6.0 @@ -46,4 +46,4 @@ collision_layer = 0 [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] position = Vector2( 1, -13 ) -shape = SubResource( 3 ) +shape = SubResource( 2 ) diff --git a/levels/test.tscn b/levels/test.tscn index b54f8ae..ea8101c 100644 --- a/levels/test.tscn +++ b/levels/test.tscn @@ -1,9 +1,8 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=2] -[ext_resource path="res://ai/Hell.tscn" type="PackedScene" id=3] -[ext_resource path="res://Music and Fonts(Misc.)/Main music.ogg" type="AudioStream" id=4] +[ext_resource path="res://ai/ogre.tscn" type="PackedScene" id=3] [node name="Node2D" type="Node2D"] @@ -13,10 +12,8 @@ tile_data = PoolIntArray( 65536, 0, 8, 65537, 0, 10, 65538, 0, 10, 65539, 0, 10, [node name="Player" parent="." instance=ExtResource( 1 )] position = Vector2( 60, 176 ) -[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] -stream = ExtResource( 4 ) -volume_db = -14.136 -autoplay = true +[node name="Ogre" parent="." instance=ExtResource( 3 )] +position = Vector2( 366, 166 ) -[node name="KinematicBody2D" parent="." instance=ExtResource( 3 )] -position = Vector2( 267.022, 161.644 ) +[node name="Ogre2" parent="." instance=ExtResource( 3 )] +position = Vector2( 430, 164 ) diff --git a/magic/Projectiles/EcoBeam.png b/magic/Beams/EcoBeam.png similarity index 100% rename from magic/Projectiles/EcoBeam.png rename to magic/Beams/EcoBeam.png diff --git a/magic/Projectiles/EcoBeam.png.import b/magic/Beams/EcoBeam.png.import similarity index 70% rename from magic/Projectiles/EcoBeam.png.import rename to magic/Beams/EcoBeam.png.import index 7ef9e60..f9150fe 100644 --- a/magic/Projectiles/EcoBeam.png.import +++ b/magic/Beams/EcoBeam.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/EcoBeam.png-3c551f43d01aa1bf4191dfc734ada98c.stex" +path="res://.import/EcoBeam.png-e73d461c66fdae1d39574d3754f12684.stex" metadata={ "vram_texture": false } [deps] -source_file="res://magic/Projectiles/EcoBeam.png" -dest_files=[ "res://.import/EcoBeam.png-3c551f43d01aa1bf4191dfc734ada98c.stex" ] +source_file="res://magic/Beams/EcoBeam.png" +dest_files=[ "res://.import/EcoBeam.png-e73d461c66fdae1d39574d3754f12684.stex" ] [params] diff --git a/magic/Beams/EcoBeam.tscn b/magic/Beams/EcoBeam.tscn index 1d73ced..6406a33 100644 --- a/magic/Beams/EcoBeam.tscn +++ b/magic/Beams/EcoBeam.tscn @@ -1,8 +1,9 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://magic/Projectiles/EcoBeam.png" type="Texture" id=1] +[ext_resource path="res://magic/Beams/EcoBeam.png" type="Texture" id=1] [ext_resource path="res://magic/Beams/EcoBeam.gd" type="Script" id=2] + [node name="EcoBeam" type="Node2D"] script = ExtResource( 2 ) diff --git a/magic/Projectiles/ExplosiveBeam.png b/magic/Beams/ExplosiveBeam.png similarity index 100% rename from magic/Projectiles/ExplosiveBeam.png rename to magic/Beams/ExplosiveBeam.png diff --git a/magic/Projectiles/ExplosiveBeam.png.import b/magic/Beams/ExplosiveBeam.png.import similarity index 67% rename from magic/Projectiles/ExplosiveBeam.png.import rename to magic/Beams/ExplosiveBeam.png.import index bd626fe..b4e4c8e 100644 --- a/magic/Projectiles/ExplosiveBeam.png.import +++ b/magic/Beams/ExplosiveBeam.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/ExplosiveBeam.png-7c64be86fe9e64da3dbfe24ba50eb32b.stex" +path="res://.import/ExplosiveBeam.png-50a91c4ddc75e981fcb0bdf51aed9d1d.stex" metadata={ "vram_texture": false } [deps] -source_file="res://magic/Projectiles/ExplosiveBeam.png" -dest_files=[ "res://.import/ExplosiveBeam.png-7c64be86fe9e64da3dbfe24ba50eb32b.stex" ] +source_file="res://magic/Beams/ExplosiveBeam.png" +dest_files=[ "res://.import/ExplosiveBeam.png-50a91c4ddc75e981fcb0bdf51aed9d1d.stex" ] [params] diff --git a/magic/Projectiles/KnockbackBeam.png b/magic/Beams/KnockbackBeam.png similarity index 100% rename from magic/Projectiles/KnockbackBeam.png rename to magic/Beams/KnockbackBeam.png diff --git a/magic/Projectiles/KnockbackBeam.png.import b/magic/Beams/KnockbackBeam.png.import similarity index 77% rename from magic/Projectiles/KnockbackBeam.png.import rename to magic/Beams/KnockbackBeam.png.import index b8039d7..ab7d9c1 100644 --- a/magic/Projectiles/KnockbackBeam.png.import +++ b/magic/Beams/KnockbackBeam.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/KnockbackBeam.png-f6b07692e76f654be45e1dacdb7f97cd.stex" +path="res://.import/KnockbackBeam.png-0fee75e86f12291aa760ef682caec9bc.stex" metadata={ "vram_texture": false } [deps] -source_file="res://magic/Projectiles/KnockbackBeam.png" -dest_files=[ "res://.import/KnockbackBeam.png-f6b07692e76f654be45e1dacdb7f97cd.stex" ] +source_file="res://magic/Beams/KnockbackBeam.png" +dest_files=[ "res://.import/KnockbackBeam.png-0fee75e86f12291aa760ef682caec9bc.stex" ] [params] diff --git a/magic/Projectiles/PhantomBeam.png b/magic/Beams/PhantomBeam.png similarity index 100% rename from magic/Projectiles/PhantomBeam.png rename to magic/Beams/PhantomBeam.png diff --git a/magic/Projectiles/PhantomBeam.png.import b/magic/Beams/PhantomBeam.png.import similarity index 68% rename from magic/Projectiles/PhantomBeam.png.import rename to magic/Beams/PhantomBeam.png.import index bce9b45..654b8f8 100644 --- a/magic/Projectiles/PhantomBeam.png.import +++ b/magic/Beams/PhantomBeam.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/PhantomBeam.png-ec0a238ba461b69d1e112c9f9f20d6d2.stex" +path="res://.import/PhantomBeam.png-8db65154664335d51de9d42a77e421a7.stex" metadata={ "vram_texture": false } [deps] -source_file="res://magic/Projectiles/PhantomBeam.png" -dest_files=[ "res://.import/PhantomBeam.png-ec0a238ba461b69d1e112c9f9f20d6d2.stex" ] +source_file="res://magic/Beams/PhantomBeam.png" +dest_files=[ "res://.import/PhantomBeam.png-8db65154664335d51de9d42a77e421a7.stex" ] [params] diff --git a/magic/Projectiles/EcoProjectile.gd b/magic/Projectiles/EcoProjectile.gd index a9e4b1a..30ee241 100644 --- a/magic/Projectiles/EcoProjectile.gd +++ b/magic/Projectiles/EcoProjectile.gd @@ -2,5 +2,7 @@ extends Projectile func _ready(): + $FireSound.play(0.0) energy_cost = 0 damage = 0.5 + diff --git a/magic/Projectiles/EcoProjectile.tscn b/magic/Projectiles/EcoProjectile.tscn index 07e0a23..b08f532 100644 --- a/magic/Projectiles/EcoProjectile.tscn +++ b/magic/Projectiles/EcoProjectile.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://art/ecoprojectile.png" type="Texture" id=1] [ext_resource path="res://magic/Projectiles/EcoProjectile.gd" type="Script" id=2] +[ext_resource path="res://Sound Effects/EcoProjectile.wav" type="AudioStream" id=3] [sub_resource type="CircleShape2D" id=1] radius = 6.08276 @@ -17,3 +18,7 @@ texture = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) + +[node name="FireSound" type="AudioStreamPlayer2D" parent="."] +scale = Vector2( 1, 1.00738 ) +stream = ExtResource( 3 ) diff --git a/magic/Projectiles/ExplosiveProjectile.gd b/magic/Projectiles/ExplosiveProjectile.gd index b5c1e76..04a3478 100644 --- a/magic/Projectiles/ExplosiveProjectile.gd +++ b/magic/Projectiles/ExplosiveProjectile.gd @@ -22,6 +22,7 @@ func explode(): body.health -= damage if body.has_method("play_hit"): body.play_hit() + $Explosion.play(0.0) $Particles2D.emitting = true $KillTimer.start() set_physics_process(false) diff --git a/magic/Projectiles/ExplosiveProjectile.tscn b/magic/Projectiles/ExplosiveProjectile.tscn index e6000e3..89ee41e 100644 --- a/magic/Projectiles/ExplosiveProjectile.tscn +++ b/magic/Projectiles/ExplosiveProjectile.tscn @@ -1,19 +1,20 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://art/MineProjectile.png" type="Texture" id=1] [ext_resource path="res://magic/Projectiles/ExplosiveProjectile.gd" type="Script" id=2] +[ext_resource path="res://Sound Effects/Explosion.wav" type="AudioStream" id=3] [sub_resource type="CircleShape2D" id=1] radius = 6.0 -[sub_resource type="Gradient" id=3] +[sub_resource type="Gradient" id=2] offsets = PoolRealArray( 0.0120482, 0.192771, 0.534137, 1 ) colors = PoolColorArray( 1, 0.449219, 0.449219, 1, 1, 0, 0, 1, 1, 0.351563, 0, 1, 0.155762, 0.155762, 0.155762, 1 ) -[sub_resource type="GradientTexture" id=4] -gradient = SubResource( 3 ) +[sub_resource type="GradientTexture" id=3] +gradient = SubResource( 2 ) -[sub_resource type="ParticlesMaterial" id=5] +[sub_resource type="ParticlesMaterial" id=4] emission_shape = 1 emission_sphere_radius = 1.0 flag_disable_z = true @@ -22,9 +23,9 @@ gravity = Vector3( 0, 0, 0 ) initial_velocity = 50.0 orbit_velocity = 0.0 orbit_velocity_random = 0.0 -color_ramp = SubResource( 4 ) +color_ramp = SubResource( 3 ) -[sub_resource type="CircleShape2D" id=2] +[sub_resource type="CircleShape2D" id=5] radius = 50.0 [node name="ExplosiveProjectile" type="KinematicBody2D"] @@ -46,14 +47,17 @@ amount = 200 one_shot = true speed_scale = 2.5 explosiveness = 0.8 -process_material = SubResource( 5 ) +process_material = SubResource( 4 ) [node name="Area2D" type="Area2D" parent="."] visible = false [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -shape = SubResource( 2 ) +shape = SubResource( 5 ) [node name="KillTimer" type="Timer" parent="."] one_shot = true + +[node name="Explosion" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource( 3 ) [connection signal="timeout" from="KillTimer" to="." method="_on_KillTimer_timeout"] diff --git a/magic/Projectiles/PhantomProjectile.gd b/magic/Projectiles/PhantomProjectile.gd index d3ff145..db1b6a8 100644 --- a/magic/Projectiles/PhantomProjectile.gd +++ b/magic/Projectiles/PhantomProjectile.gd @@ -4,6 +4,7 @@ extends Projectile var ignore = [] func _ready(): + $FireSound.play(0.0) energy_cost = 3 damage = 1 diff --git a/magic/Projectiles/PhantomProjectile.tscn b/magic/Projectiles/PhantomProjectile.tscn index 52751a0..59b1195 100644 --- a/magic/Projectiles/PhantomProjectile.tscn +++ b/magic/Projectiles/PhantomProjectile.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://art/PhantomProjectile.png" type="Texture" id=1] [ext_resource path="res://magic/Projectiles/PhantomProjectile.gd" type="Script" id=2] +[ext_resource path="res://Sound Effects/PhantomProjectile.wav" type="AudioStream" id=3] -[sub_resource type="RectangleShape2D" id=3] +[sub_resource type="RectangleShape2D" id=1] extents = Vector2( 3, 6 ) [sub_resource type="CapsuleShape2D" id=2] @@ -21,7 +22,7 @@ texture = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] rotation = 1.5708 -shape = SubResource( 3 ) +shape = SubResource( 1 ) [node name="Area2D" type="Area2D" parent="."] monitorable = false @@ -31,4 +32,7 @@ collision_mask = 4 [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] rotation = 1.5708 shape = SubResource( 2 ) + +[node name="FireSound" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource( 3 ) [connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"] diff --git a/magic/Projectiles/Projectile.gd b/magic/Projectiles/Projectile.gd index a8bbae0..905198a 100644 --- a/magic/Projectiles/Projectile.gd +++ b/magic/Projectiles/Projectile.gd @@ -47,10 +47,20 @@ func on_impact(collision): var c = collision.collider c.health -= damage * damage_mod c.play_hit() + if $FireSound.playing: + set_physics_process(false) + $CollisionShape2D.disabled = true + $Sprite.visible = false + yield($FireSound, "finished") queue_free() elif bounces_left != 0: bounces_left -= 1 look_at(position + velocity.bounce(collision.normal)) launch(null) else: + if $FireSound.playing: + set_physics_process(false) + $CollisionShape2D.disabled = true + $Sprite.visible = false + yield($FireSound, "finished") queue_free() diff --git a/magic/Projectiles/WaveProjectile.gd b/magic/Projectiles/WaveProjectile.gd index 4bf566f..3bef392 100644 --- a/magic/Projectiles/WaveProjectile.gd +++ b/magic/Projectiles/WaveProjectile.gd @@ -1,6 +1,7 @@ extends Projectile func _ready(): + $FireSound.play(0.0) energy_cost = 2 damage = 1 @@ -11,10 +12,20 @@ func on_impact(collision): c.health -= damage * damage_mod c.do_knockback(collision.normal) c.play_hit() + if $FireSound.playing: + set_physics_process(false) + $CollisionShape2D.disabled = true + $Sprite.visible = false + yield($FireSound, "finished") queue_free() elif bounces_left != 0: bounces_left -= 1 look_at(position + velocity.bounce(collision.normal)) launch(null) else: + if $FireSound.playing: + set_physics_process(false) + $CollisionShape2D.disabled = true + $Sprite.visible = false + yield($FireSound, "finished") queue_free() diff --git a/magic/Projectiles/WaveProjectile.tscn b/magic/Projectiles/WaveProjectile.tscn index 1397157..0feaf09 100644 --- a/magic/Projectiles/WaveProjectile.tscn +++ b/magic/Projectiles/WaveProjectile.tscn @@ -1,11 +1,12 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://art/WaveProjectile.png" type="Texture" id=1] [ext_resource path="res://magic/Projectiles/WaveProjectile.gd" type="Script" id=2] +[ext_resource path="res://Sound Effects/WaveProjectile.wav" type="AudioStream" id=3] [sub_resource type="CapsuleShape2D" id=1] -radius = 5.0 -height = 4.0 +radius = 7.0 +height = 0.0 [node name="WaveProjectile" type="KinematicBody2D"] collision_layer = 8 @@ -19,3 +20,7 @@ texture = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2( -1, 0 ) shape = SubResource( 1 ) + +[node name="FireSound" type="AudioStreamPlayer2D" parent="."] +scale = Vector2( 1.02767, 0.931674 ) +stream = ExtResource( 3 ) diff --git a/project.godot b/project.godot index f3c8e77..f635f4f 100644 --- a/project.godot +++ b/project.godot @@ -161,11 +161,6 @@ inventory={ "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null) ] } -open={ -"deadzone": 0.5, -"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"unicode":0,"echo":false,"script":null) - ] -} [layer_names] diff --git a/script/player.gd b/script/player.gd index 38b3849..8168b60 100644 --- a/script/player.gd +++ b/script/player.gd @@ -29,9 +29,14 @@ onready var ProjectileSpawn: Node2D = $HoldPosition/ProjectileSpawn onready var Inventory: CanvasLayer = $Inventory onready var Stats = $Stats +onready var HitSound: AudioStreamPlayer2D = $"Enemy Hit" + onready var health = Stats.health setget set_health, get_health onready var energy = Stats.energy setget set_energy, get_energy +func play_hitsound(): + HitSound.play(0.0) + func get_current_conduit(): return Inventory.active_conduit diff --git a/ui/PlayerStats.gd b/ui/PlayerStats.gd index 9c2d632..b75c9a7 100644 --- a/ui/PlayerStats.gd +++ b/ui/PlayerStats.gd @@ -35,6 +35,8 @@ func _process(delta): set_energy(Player.energy) func set_health(value): + if Hearts.value > value: + get_parent().play_hitsound() Hearts.value = clamp(value, Hearts.min_value, Hearts.max_value) Player.health = get_health()