audiooooo!
This commit is contained in:
		@@ -1,8 +1,13 @@
 | 
			
		||||
[gd_scene load_steps=5 format=3 uid="uid://brnx3xyyd0e71"]
 | 
			
		||||
[gd_scene load_steps=10 format=3 uid="uid://brnx3xyyd0e71"]
 | 
			
		||||
 | 
			
		||||
[ext_resource type="PackedScene" uid="uid://kkfxguj0lr5a" path="res://Scenes/Spawnables/template_spawnable.tscn" id="1_verf7"]
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://ddvr5ltbo8ome" path="res://Assets/Bat/noBKG_BatFlight_strip.png" id="2_0p8tq"]
 | 
			
		||||
[ext_resource type="Script" path="res://Scenes/Spawnables/AIs/ai_bat.gd" id="2_x3ldf"]
 | 
			
		||||
[ext_resource type="AudioStream" uid="uid://cy210ijd2v1dt" path="res://Assets/Audio/Bats/bat_spawn1.mp3" id="4_23i1n"]
 | 
			
		||||
[ext_resource type="AudioStream" uid="uid://cgtd1h5ewkq5d" path="res://Assets/Audio/Bats/bat_spawn2.mp3" id="5_lxf0c"]
 | 
			
		||||
[ext_resource type="AudioStream" uid="uid://dbwrhm30srugh" path="res://Assets/Audio/Bats/bat_spawn3.mp3" id="6_i83i4"]
 | 
			
		||||
[ext_resource type="AudioStream" uid="uid://gd8crqxuiivn" path="res://Assets/Audio/Bats/bat_spawn4.mp3" id="7_hh1mb"]
 | 
			
		||||
[ext_resource type="AudioStream" uid="uid://dyl0goef8y6bu" path="res://Assets/Audio/Bats/bat_spawn5.mp3" id="8_o2d7p"]
 | 
			
		||||
 | 
			
		||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bnd0j"]
 | 
			
		||||
atlas = ExtResource("2_0p8tq")
 | 
			
		||||
@@ -26,3 +31,18 @@ frame_progress = 0.482614
 | 
			
		||||
 | 
			
		||||
[node name="AI" parent="." index="5"]
 | 
			
		||||
script = ExtResource("2_x3ldf")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn1" parent="." index="8"]
 | 
			
		||||
stream = ExtResource("4_23i1n")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn2" parent="." index="9"]
 | 
			
		||||
stream = ExtResource("5_lxf0c")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn3" parent="." index="10"]
 | 
			
		||||
stream = ExtResource("6_i83i4")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn4" parent="." index="11"]
 | 
			
		||||
stream = ExtResource("7_hh1mb")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn5" parent="." index="12"]
 | 
			
		||||
stream = ExtResource("8_o2d7p")
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,8 @@ extends CharacterBody2D
 | 
			
		||||
 | 
			
		||||
const ATTACK_COOLDOWN : float = 100
 | 
			
		||||
 | 
			
		||||
var rng = RandomNumberGenerator.new()
 | 
			
		||||
 | 
			
		||||
@export var maxHp : int = 0
 | 
			
		||||
@export var attackSpeed : float = 0
 | 
			
		||||
@export var speed : float = 0
 | 
			
		||||
@@ -22,6 +24,9 @@ const ATTACK_COOLDOWN : float = 100
 | 
			
		||||
@onready var damageCollision : CollisionShape2D = $DamageArea/DamageCollision
 | 
			
		||||
@onready var bodyCollision : CollisionShape2D = $BodyCollision
 | 
			
		||||
@onready var spawnableUI : Control = $UIContainer/SpawnableUI
 | 
			
		||||
@onready var spawnSnd: Array = [ $Spawn1, $Spawn2, $Spawn3, $Spawn4, $Spawn5 ]
 | 
			
		||||
@onready var hitSnd: Array = [ $Hit1, $Hit2, $Hit3, $Hit4, $Hit5 ]
 | 
			
		||||
@onready var dieSnd: Array = [ $Die1, $Die2, $Die3, $Die4, $Die5 ]
 | 
			
		||||
 | 
			
		||||
var isAlive : bool = true
 | 
			
		||||
var isFacingLeft : bool = false
 | 
			
		||||
@@ -88,6 +93,7 @@ func endAttack():
 | 
			
		||||
	animatedSprite.play("default")
 | 
			
		||||
 | 
			
		||||
func receive_damage(dmg):
 | 
			
		||||
	hitSnd[rng.randi_range(0,4)].play();
 | 
			
		||||
	if !isAlive:
 | 
			
		||||
		return
 | 
			
		||||
	if currentHp - dmg <= 0:
 | 
			
		||||
@@ -98,6 +104,7 @@ func receive_damage(dmg):
 | 
			
		||||
	spawnableUI.setHP(currentHp, maxHp)
 | 
			
		||||
 | 
			
		||||
func die():
 | 
			
		||||
	dieSnd[rng.randi_range(0,4)].play();
 | 
			
		||||
	enemy.remove_foe(self)
 | 
			
		||||
	signal_death.emit(self)
 | 
			
		||||
	bodyCollision.disabled = true
 | 
			
		||||
@@ -123,3 +130,8 @@ func clean():
 | 
			
		||||
func _on_damage_area_body_entered(body):
 | 
			
		||||
	if body == enemy:
 | 
			
		||||
		body.receive_damage(damage)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func _on_tree_entered():
 | 
			
		||||
	spawnSnd[rng.randi_range(0,4)].play();
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,11 @@
 | 
			
		||||
[gd_scene load_steps=39 format=3 uid="uid://kkfxguj0lr5a"]
 | 
			
		||||
[gd_scene load_steps=40 format=3 uid="uid://kkfxguj0lr5a"]
 | 
			
		||||
 | 
			
		||||
[ext_resource type="Script" path="res://Scenes/Spawnables/template_spawnable.gd" id="1_rkej7"]
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://f60ndepwmpj2" path="res://Assets/Bat/noBKG_BatAttack_strip.png" id="2_7ayi7"]
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://bd74k1s6qdx2r" path="res://Assets/Bat/noBKG_BatDeath_strip.png" id="3_jipj7"]
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://ddvr5ltbo8ome" path="res://Assets/Bat/noBKG_BatFlight_strip.png" id="4_u36ok"]
 | 
			
		||||
[ext_resource type="PackedScene" uid="uid://fojbwshce7ah" path="res://Scenes/Spawnables/UI/SpawnableUI.tscn" id="5_c2blu"]
 | 
			
		||||
[ext_resource type="AudioStream" uid="uid://c5llasu6omp0p" path="res://Assets/Audio/punch-140236.mp3" id="6_jg6bm"]
 | 
			
		||||
 | 
			
		||||
[sub_resource type="AtlasTexture" id="AtlasTexture_y0lcs"]
 | 
			
		||||
atlas = ExtResource("2_7ayi7")
 | 
			
		||||
@@ -289,4 +290,45 @@ debug_color = Color(0.639216, 0, 0.156863, 0.419608)
 | 
			
		||||
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
 | 
			
		||||
occluder = SubResource("OccluderPolygon2D_qtt12")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn1" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Spawn2" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Spawn3" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Spawn4" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Spawn5" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Hit1" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
stream = ExtResource("6_jg6bm")
 | 
			
		||||
pitch_scale = 1.78
 | 
			
		||||
 | 
			
		||||
[node name="Hit2" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
stream = ExtResource("6_jg6bm")
 | 
			
		||||
pitch_scale = 2.51
 | 
			
		||||
 | 
			
		||||
[node name="Hit3" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
stream = ExtResource("6_jg6bm")
 | 
			
		||||
pitch_scale = 1.3
 | 
			
		||||
 | 
			
		||||
[node name="Hit4" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
stream = ExtResource("6_jg6bm")
 | 
			
		||||
pitch_scale = 1.68
 | 
			
		||||
 | 
			
		||||
[node name="Hit5" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
stream = ExtResource("6_jg6bm")
 | 
			
		||||
pitch_scale = 1.17
 | 
			
		||||
 | 
			
		||||
[node name="Die1" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Die2" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Die3" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Die4" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Die5" type="AudioStreamPlayer2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[connection signal="tree_entered" from="." to="." method="_on_tree_entered"]
 | 
			
		||||
[connection signal="body_entered" from="DamageArea" to="." method="_on_damage_area_body_entered"]
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,13 @@
 | 
			
		||||
[gd_scene load_steps=54 format=3 uid="uid://35re5c6wyhp5"]
 | 
			
		||||
[gd_scene load_steps=57 format=3 uid="uid://cwlfq7dnrtgh7"]
 | 
			
		||||
 | 
			
		||||
[ext_resource type="PackedScene" uid="uid://kkfxguj0lr5a" path="res://Scenes/Spawnables/template_spawnable.tscn" id="1_t7ryl"]
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://bnch5lviqbpka" path="res://Assets/Wolf/noBKG_WolfRun_strip.png" id="2_35toa"]
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://bvscc18reoyoo" path="res://Assets/Wolf/noBKG_WolfAttack_strip.png" id="2_arbvu"]
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://dd1cbeyvlpn53" path="res://Assets/Wolf/noBKG_WolfIdle_strip.png" id="2_bk8d7"]
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://cowhod231qvc7" path="res://Assets/Wolf/noBKG_WolfDeath_strip.png" id="3_tbpyw"]
 | 
			
		||||
[ext_resource type="AudioStream" uid="uid://j1fxgwc22xsk" path="res://Assets/Audio/Wolves/mixkit-hellhound-monster-attack-dog-wolf-creature-3015.wav" id="6_1imso"]
 | 
			
		||||
[ext_resource type="AudioStream" uid="uid://cvu0rfyj8amhi" path="res://Assets/Audio/Wolves/mixkit-werewolf-roar-1730.mp3" id="7_brppl"]
 | 
			
		||||
[ext_resource type="AudioStream" uid="uid://beuuur3tlsjrp" path="res://Assets/Audio/Wolves/mixkit-wolves-pack-howling-1776.wav" id="8_k62ik"]
 | 
			
		||||
 | 
			
		||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n1jpo"]
 | 
			
		||||
atlas = ExtResource("2_bk8d7")
 | 
			
		||||
@@ -353,6 +356,7 @@ offset_bottom = 2.0
 | 
			
		||||
[node name="AnimatedSprite2D" parent="." index="1"]
 | 
			
		||||
sprite_frames = SubResource("SpriteFrames_iknep")
 | 
			
		||||
animation = &"default"
 | 
			
		||||
frame = 0
 | 
			
		||||
frame_progress = 0.996176
 | 
			
		||||
 | 
			
		||||
[node name="BodyCollision" parent="." index="2"]
 | 
			
		||||
@@ -369,3 +373,20 @@ shape = SubResource("CapsuleShape2D_dmcm0")
 | 
			
		||||
[node name="LightOccluder2D" parent="." index="7"]
 | 
			
		||||
position = Vector2(3, 0)
 | 
			
		||||
occluder = SubResource("OccluderPolygon2D_jmta4")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn1" parent="." index="8"]
 | 
			
		||||
stream = ExtResource("6_1imso")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn2" parent="." index="9"]
 | 
			
		||||
stream = ExtResource("7_brppl")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn3" parent="." index="10"]
 | 
			
		||||
stream = ExtResource("8_k62ik")
 | 
			
		||||
 | 
			
		||||
[node name="Spawn4" parent="." index="11"]
 | 
			
		||||
stream = ExtResource("6_1imso")
 | 
			
		||||
pitch_scale = 0.83
 | 
			
		||||
 | 
			
		||||
[node name="Spawn5" parent="." index="12"]
 | 
			
		||||
stream = ExtResource("7_brppl")
 | 
			
		||||
pitch_scale = 0.8
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user