diff --git a/assets/spider2.tscn b/assets/spider2.tscn index 19d572c..afdac06 100644 --- a/assets/spider2.tscn +++ b/assets/spider2.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=76 format=4 uid="uid://djr7vnr1hcx82"] +[gd_scene load_steps=77 format=4 uid="uid://djr7vnr1hcx82"] [ext_resource type="Script" uid="uid://cdofgtwevbray" path="res://scripts/spider.gd" id="1_7e7fe"] [ext_resource type="PackedScene" uid="uid://h5ojldugfyyu" path="res://assets/bullet_enemy.tscn" id="2_aew5r"] @@ -15,6 +15,7 @@ [ext_resource type="Texture2D" uid="uid://chiol2whyb84t" path="res://assets/Models/SubstancePainterTest/spider-LOW_spider1.gunbarrel_Metallic.png" id="9_cwyr0"] [ext_resource type="PackedScene" uid="uid://41iv1ualpttf" path="res://assets/damage_number.tscn" id="9_rmegy"] [ext_resource type="AudioStream" uid="uid://0n251thxlnnp" path="res://assets/Audio/cannon-fire-single-shot-blast-explosion-SBA-300098885.wav" id="10_2qmhc"] +[ext_resource type="Script" uid="uid://cr3wdhodxqf3f" path="res://scripts/EnemyAttack.gd" id="10_gicen"] [ext_resource type="Texture2D" uid="uid://c7bdujukdjajv" path="res://assets/Models/SubstancePainterTest/spider-LOW_spider1.gunbarrel_Normal.png" id="10_wpql0"] [ext_resource type="Texture2D" uid="uid://d0w0lon4smlhm" path="res://assets/Models/SubstancePainterTest/spider-LOW_spider1.gunbarrel_Roughness.png" id="11_6mvds"] [ext_resource type="Material" uid="uid://cc0el8wu0au85" path="res://assets/materials/OutlineMat.tres" id="13_ee4im"] @@ -824,6 +825,9 @@ script = ExtResource("9_6mvds") enemy = NodePath("../..") metadata/_custom_type_script = "uid://dhxolagi0b5s1" +[node name="Attack" type="Node" parent="StateMachine"] +script = ExtResource("10_gicen") + [node name="HealthBarSprite" parent="." node_paths=PackedStringArray("character") instance=ExtResource("7_87l3v")] transform = Transform3D(0.254412, 0, 0, 0, 0.561068, 0, 0, 0, 1, 0, 2.41498, 0) billboard = 2 diff --git a/scripts/EnemyAttack.gd b/scripts/EnemyAttack.gd new file mode 100644 index 0000000..c87d4ea --- /dev/null +++ b/scripts/EnemyAttack.gd @@ -0,0 +1,2 @@ +extends EnemyState +class_name EnemyAttack diff --git a/scripts/EnemyAttack.gd.uid b/scripts/EnemyAttack.gd.uid new file mode 100644 index 0000000..996b7c3 --- /dev/null +++ b/scripts/EnemyAttack.gd.uid @@ -0,0 +1 @@ +uid://cr3wdhodxqf3f diff --git a/scripts/enemy_die.gd b/scripts/enemy_die.gd index dd32501..43e36a4 100644 --- a/scripts/enemy_die.gd +++ b/scripts/enemy_die.gd @@ -4,9 +4,10 @@ const MAX_LV = 10 const MAX_AV = 10 func Enter(): - drop_loot() + die() func die(): + drop_loot() #remove from parent array var particlespawn = enemy.die_particles.instantiate() particlespawn.position = enemy.global_position @@ -21,7 +22,6 @@ func die(): GameGlobals.last_hit_path = null SignalBus.emit_signal("enemy_killed") - enemy.queue_free() func drop_loot(): var number_of_drops = enemy.loot_amount @@ -47,11 +47,11 @@ func drop_loot(): number_of_drops -= 1 await number_of_drops <= 0 - die() + enemy.queue_free() func random_av_lv(): var lv_x = randf_range(-MAX_LV,MAX_LV) - var lv_y = randf_range(-MAX_LV,MAX_LV) + var lv_y = randf_range(0,MAX_LV) var lv_z = randf_range(-MAX_LV,MAX_LV) var av_x = randf_range(-MAX_AV,MAX_AV) var av_y = randf_range(-MAX_AV,MAX_AV)