Most things have sound effects

This commit is contained in:
Logan 2020-07-21 15:50:32 -05:00
parent 326bc2df93
commit f2829a8046
34 changed files with 195 additions and 52 deletions

View file

@ -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://script/player.gd" type="Script" id=1]
[ext_resource path="res://ui/PlayerStats.tscn" type="PackedScene" id=2] [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://script/WandPosition.gd" type="Script" id=7]
[ext_resource path="res://art/Paralax Dungeon.png" type="Texture" id=8] [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.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] [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 ) 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 ) position = Vector2( 192, 90 )
texture = ExtResource( 8 ) texture = ExtResource( 8 )
[node name="Enemy Hit" type="AudioStreamPlayer" parent="."] [node name="Enemy Hit" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 9 ) stream = ExtResource( 9 )
volume_db = -8.077 volume_db = -8.077
[node name="Enemy Hit Wall" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 10 )
volume_db = -7.068

Binary file not shown.

View file

@ -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

BIN
Sound Effects/Explosion.wav Normal file

Binary file not shown.

View file

@ -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

Binary file not shown.

View file

@ -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

Binary file not shown.

View file

@ -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

Binary file not shown.

View file

@ -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

View file

@ -8,7 +8,7 @@
[sub_resource type="CapsuleShape2D" id=1] [sub_resource type="CapsuleShape2D" id=1]
height = 4.0 height = 4.0
[sub_resource type="CapsuleShape2D" id=3] [sub_resource type="CapsuleShape2D" id=2]
radius = 12.0 radius = 12.0
height = 6.0 height = 6.0
@ -46,4 +46,4 @@ collision_layer = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 1, -13 ) position = Vector2( 1, -13 )
shape = SubResource( 3 ) shape = SubResource( 2 )

View file

@ -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://Player/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=2] [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://ai/ogre.tscn" type="PackedScene" id=3]
[ext_resource path="res://Music and Fonts(Misc.)/Main music.ogg" type="AudioStream" id=4]
[node name="Node2D" type="Node2D"] [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 )] [node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 60, 176 ) position = Vector2( 60, 176 )
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] [node name="Ogre" parent="." instance=ExtResource( 3 )]
stream = ExtResource( 4 ) position = Vector2( 366, 166 )
volume_db = -14.136
autoplay = true
[node name="KinematicBody2D" parent="." instance=ExtResource( 3 )] [node name="Ogre2" parent="." instance=ExtResource( 3 )]
position = Vector2( 267.022, 161.644 ) position = Vector2( 430, 164 )

View file

Before

Width:  |  Height:  |  Size: 117 B

After

Width:  |  Height:  |  Size: 117 B

View file

@ -2,15 +2,15 @@
importer="texture" importer="texture"
type="StreamTexture" type="StreamTexture"
path="res://.import/EcoBeam.png-3c551f43d01aa1bf4191dfc734ada98c.stex" path="res://.import/EcoBeam.png-e73d461c66fdae1d39574d3754f12684.stex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://magic/Projectiles/EcoBeam.png" source_file="res://magic/Beams/EcoBeam.png"
dest_files=[ "res://.import/EcoBeam.png-3c551f43d01aa1bf4191dfc734ada98c.stex" ] dest_files=[ "res://.import/EcoBeam.png-e73d461c66fdae1d39574d3754f12684.stex" ]
[params] [params]

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=3 format=2] [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] [ext_resource path="res://magic/Beams/EcoBeam.gd" type="Script" id=2]
[node name="EcoBeam" type="Node2D"] [node name="EcoBeam" type="Node2D"]
script = ExtResource( 2 ) script = ExtResource( 2 )

View file

Before

Width:  |  Height:  |  Size: 117 B

After

Width:  |  Height:  |  Size: 117 B

View file

@ -2,15 +2,15 @@
importer="texture" importer="texture"
type="StreamTexture" type="StreamTexture"
path="res://.import/ExplosiveBeam.png-7c64be86fe9e64da3dbfe24ba50eb32b.stex" path="res://.import/ExplosiveBeam.png-50a91c4ddc75e981fcb0bdf51aed9d1d.stex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://magic/Projectiles/ExplosiveBeam.png" source_file="res://magic/Beams/ExplosiveBeam.png"
dest_files=[ "res://.import/ExplosiveBeam.png-7c64be86fe9e64da3dbfe24ba50eb32b.stex" ] dest_files=[ "res://.import/ExplosiveBeam.png-50a91c4ddc75e981fcb0bdf51aed9d1d.stex" ]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 117 B

After

Width:  |  Height:  |  Size: 117 B

View file

@ -2,15 +2,15 @@
importer="texture" importer="texture"
type="StreamTexture" type="StreamTexture"
path="res://.import/KnockbackBeam.png-f6b07692e76f654be45e1dacdb7f97cd.stex" path="res://.import/KnockbackBeam.png-0fee75e86f12291aa760ef682caec9bc.stex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://magic/Projectiles/KnockbackBeam.png" source_file="res://magic/Beams/KnockbackBeam.png"
dest_files=[ "res://.import/KnockbackBeam.png-f6b07692e76f654be45e1dacdb7f97cd.stex" ] dest_files=[ "res://.import/KnockbackBeam.png-0fee75e86f12291aa760ef682caec9bc.stex" ]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 116 B

View file

@ -2,15 +2,15 @@
importer="texture" importer="texture"
type="StreamTexture" type="StreamTexture"
path="res://.import/PhantomBeam.png-ec0a238ba461b69d1e112c9f9f20d6d2.stex" path="res://.import/PhantomBeam.png-8db65154664335d51de9d42a77e421a7.stex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://magic/Projectiles/PhantomBeam.png" source_file="res://magic/Beams/PhantomBeam.png"
dest_files=[ "res://.import/PhantomBeam.png-ec0a238ba461b69d1e112c9f9f20d6d2.stex" ] dest_files=[ "res://.import/PhantomBeam.png-8db65154664335d51de9d42a77e421a7.stex" ]
[params] [params]

View file

@ -2,5 +2,7 @@ extends Projectile
func _ready(): func _ready():
$FireSound.play(0.0)
energy_cost = 0 energy_cost = 0
damage = 0.5 damage = 0.5

View file

@ -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://art/ecoprojectile.png" type="Texture" id=1]
[ext_resource path="res://magic/Projectiles/EcoProjectile.gd" type="Script" id=2] [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] [sub_resource type="CircleShape2D" id=1]
radius = 6.08276 radius = 6.08276
@ -17,3 +18,7 @@ texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 ) shape = SubResource( 1 )
[node name="FireSound" type="AudioStreamPlayer2D" parent="."]
scale = Vector2( 1, 1.00738 )
stream = ExtResource( 3 )

View file

@ -22,6 +22,7 @@ func explode():
body.health -= damage body.health -= damage
if body.has_method("play_hit"): if body.has_method("play_hit"):
body.play_hit() body.play_hit()
$Explosion.play(0.0)
$Particles2D.emitting = true $Particles2D.emitting = true
$KillTimer.start() $KillTimer.start()
set_physics_process(false) set_physics_process(false)

View file

@ -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://art/MineProjectile.png" type="Texture" id=1]
[ext_resource path="res://magic/Projectiles/ExplosiveProjectile.gd" type="Script" id=2] [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] [sub_resource type="CircleShape2D" id=1]
radius = 6.0 radius = 6.0
[sub_resource type="Gradient" id=3] [sub_resource type="Gradient" id=2]
offsets = PoolRealArray( 0.0120482, 0.192771, 0.534137, 1 ) 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 ) 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] [sub_resource type="GradientTexture" id=3]
gradient = SubResource( 3 ) gradient = SubResource( 2 )
[sub_resource type="ParticlesMaterial" id=5] [sub_resource type="ParticlesMaterial" id=4]
emission_shape = 1 emission_shape = 1
emission_sphere_radius = 1.0 emission_sphere_radius = 1.0
flag_disable_z = true flag_disable_z = true
@ -22,9 +23,9 @@ gravity = Vector3( 0, 0, 0 )
initial_velocity = 50.0 initial_velocity = 50.0
orbit_velocity = 0.0 orbit_velocity = 0.0
orbit_velocity_random = 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 radius = 50.0
[node name="ExplosiveProjectile" type="KinematicBody2D"] [node name="ExplosiveProjectile" type="KinematicBody2D"]
@ -46,14 +47,17 @@ amount = 200
one_shot = true one_shot = true
speed_scale = 2.5 speed_scale = 2.5
explosiveness = 0.8 explosiveness = 0.8
process_material = SubResource( 5 ) process_material = SubResource( 4 )
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
visible = false visible = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource( 2 ) shape = SubResource( 5 )
[node name="KillTimer" type="Timer" parent="."] [node name="KillTimer" type="Timer" parent="."]
one_shot = true one_shot = true
[node name="Explosion" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 3 )
[connection signal="timeout" from="KillTimer" to="." method="_on_KillTimer_timeout"] [connection signal="timeout" from="KillTimer" to="." method="_on_KillTimer_timeout"]

View file

@ -4,6 +4,7 @@ extends Projectile
var ignore = [] var ignore = []
func _ready(): func _ready():
$FireSound.play(0.0)
energy_cost = 3 energy_cost = 3
damage = 1 damage = 1

View file

@ -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://art/PhantomProjectile.png" type="Texture" id=1]
[ext_resource path="res://magic/Projectiles/PhantomProjectile.gd" type="Script" id=2] [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 ) extents = Vector2( 3, 6 )
[sub_resource type="CapsuleShape2D" id=2] [sub_resource type="CapsuleShape2D" id=2]
@ -21,7 +22,7 @@ texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708 rotation = 1.5708
shape = SubResource( 3 ) shape = SubResource( 1 )
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
monitorable = false monitorable = false
@ -31,4 +32,7 @@ collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
rotation = 1.5708 rotation = 1.5708
shape = SubResource( 2 ) shape = SubResource( 2 )
[node name="FireSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 3 )
[connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"] [connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"]

View file

@ -47,10 +47,20 @@ func on_impact(collision):
var c = collision.collider var c = collision.collider
c.health -= damage * damage_mod c.health -= damage * damage_mod
c.play_hit() c.play_hit()
if $FireSound.playing:
set_physics_process(false)
$CollisionShape2D.disabled = true
$Sprite.visible = false
yield($FireSound, "finished")
queue_free() queue_free()
elif bounces_left != 0: elif bounces_left != 0:
bounces_left -= 1 bounces_left -= 1
look_at(position + velocity.bounce(collision.normal)) look_at(position + velocity.bounce(collision.normal))
launch(null) launch(null)
else: else:
if $FireSound.playing:
set_physics_process(false)
$CollisionShape2D.disabled = true
$Sprite.visible = false
yield($FireSound, "finished")
queue_free() queue_free()

View file

@ -1,6 +1,7 @@
extends Projectile extends Projectile
func _ready(): func _ready():
$FireSound.play(0.0)
energy_cost = 2 energy_cost = 2
damage = 1 damage = 1
@ -11,10 +12,20 @@ func on_impact(collision):
c.health -= damage * damage_mod c.health -= damage * damage_mod
c.do_knockback(collision.normal) c.do_knockback(collision.normal)
c.play_hit() c.play_hit()
if $FireSound.playing:
set_physics_process(false)
$CollisionShape2D.disabled = true
$Sprite.visible = false
yield($FireSound, "finished")
queue_free() queue_free()
elif bounces_left != 0: elif bounces_left != 0:
bounces_left -= 1 bounces_left -= 1
look_at(position + velocity.bounce(collision.normal)) look_at(position + velocity.bounce(collision.normal))
launch(null) launch(null)
else: else:
if $FireSound.playing:
set_physics_process(false)
$CollisionShape2D.disabled = true
$Sprite.visible = false
yield($FireSound, "finished")
queue_free() queue_free()

View file

@ -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://art/WaveProjectile.png" type="Texture" id=1]
[ext_resource path="res://magic/Projectiles/WaveProjectile.gd" type="Script" id=2] [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] [sub_resource type="CapsuleShape2D" id=1]
radius = 5.0 radius = 7.0
height = 4.0 height = 0.0
[node name="WaveProjectile" type="KinematicBody2D"] [node name="WaveProjectile" type="KinematicBody2D"]
collision_layer = 8 collision_layer = 8
@ -19,3 +20,7 @@ texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( -1, 0 ) position = Vector2( -1, 0 )
shape = SubResource( 1 ) shape = SubResource( 1 )
[node name="FireSound" type="AudioStreamPlayer2D" parent="."]
scale = Vector2( 1.02767, 0.931674 )
stream = ExtResource( 3 )

View file

@ -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) "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] [layer_names]

View file

@ -29,9 +29,14 @@ onready var ProjectileSpawn: Node2D = $HoldPosition/ProjectileSpawn
onready var Inventory: CanvasLayer = $Inventory onready var Inventory: CanvasLayer = $Inventory
onready var Stats = $Stats onready var Stats = $Stats
onready var HitSound: AudioStreamPlayer2D = $"Enemy Hit"
onready var health = Stats.health setget set_health, get_health onready var health = Stats.health setget set_health, get_health
onready var energy = Stats.energy setget set_energy, get_energy onready var energy = Stats.energy setget set_energy, get_energy
func play_hitsound():
HitSound.play(0.0)
func get_current_conduit(): func get_current_conduit():
return Inventory.active_conduit return Inventory.active_conduit

View file

@ -35,6 +35,8 @@ func _process(delta):
set_energy(Player.energy) set_energy(Player.energy)
func set_health(value): func set_health(value):
if Hearts.value > value:
get_parent().play_hitsound()
Hearts.value = clamp(value, Hearts.min_value, Hearts.max_value) Hearts.value = clamp(value, Hearts.min_value, Hearts.max_value)
Player.health = get_health() Player.health = get_health()