Update stuff
This commit is contained in:
@@ -11,7 +11,6 @@ public partial class EnemyBullet : Projectile
|
||||
public new void OnProjectileHit(Node node)
|
||||
{
|
||||
SetPhysicsProcess(false);
|
||||
_hitBox.QueueFree();
|
||||
|
||||
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
|
||||
{
|
||||
@@ -19,9 +18,6 @@ public partial class EnemyBullet : Projectile
|
||||
character.Call(Character.MethodName.OnHit, node);
|
||||
}
|
||||
|
||||
|
||||
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
|
||||
if (!sfxPlayer.Playing)
|
||||
sfxPlayer.Play();
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@ public partial class HealthPoints : Node
|
||||
|
||||
public long CurrentHP { get; protected set; }
|
||||
|
||||
[Export]
|
||||
private TextureProgressBar _healthBar;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
CurrentHP = MaximumHP;
|
||||
@@ -20,9 +17,4 @@ public partial class HealthPoints : Node
|
||||
CurrentHP -= damage;
|
||||
GD.Print(CurrentHP);
|
||||
}
|
||||
|
||||
public void UpdateHealthbar()
|
||||
{
|
||||
_healthBar.Value = CurrentHP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public partial class HealthbarProgress : TextureProgressBar
|
||||
{
|
||||
public void UpdateBar(long amount, long full)
|
||||
public void UpdateBar(long amount)
|
||||
{
|
||||
Value = amount;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=47 format=3 uid="uid://bt5rolsyjmx55"]
|
||||
[gd_scene load_steps=48 format=3 uid="uid://bt5rolsyjmx55"]
|
||||
|
||||
[ext_resource type="Script" path="res://Enemies/Scripts/MeleeEnemy.cs" id="1_50och"]
|
||||
[ext_resource type="PackedScene" uid="uid://b1j0g6ikmnibm" path="res://Enemies/HPComponent.tscn" id="2_1leby"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_1nq5h"]
|
||||
size = Vector3(0.579358, 2.18762, 0.423598)
|
||||
@@ -1173,12 +1174,13 @@ _data = {
|
||||
"Animation": SubResource("Animation_xyhqi")
|
||||
}
|
||||
|
||||
[node name="Melee Enemy" type="CharacterBody3D" groups=["Enemy"]]
|
||||
[node name="Melee Enemy" type="CharacterBody3D" node_paths=PackedStringArray("_hp") groups=["Enemy"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.251952, 0)
|
||||
collision_layer = 0
|
||||
collision_mask = 5
|
||||
axis_lock_angular_x = true
|
||||
script = ExtResource("1_50och")
|
||||
_hp = NodePath("HP Component")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0840461, 0.475385, 0.143401)
|
||||
@@ -1242,3 +1244,6 @@ transform = Transform3D(0.404405, 0, 0, 0, 0.404405, 0, 0, 0, 0.404405, 0.069068
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_ivhl3")
|
||||
}
|
||||
|
||||
[node name="HP Component" parent="." instance=ExtResource("2_1leby")]
|
||||
MaximumHP = 1
|
||||
|
||||
336
Enemies/Models/DISSAPPEARING ENEMY.gltf
Normal file
336
Enemies/Models/DISSAPPEARING ENEMY.gltf
Normal file
File diff suppressed because one or more lines are too long
32
Enemies/Models/DISSAPPEARING ENEMY.gltf.import
Normal file
32
Enemies/Models/DISSAPPEARING ENEMY.gltf.import
Normal file
@@ -0,0 +1,32 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dr6vgrhs3joil"
|
||||
path="res://.godot/imported/DISSAPPEARING ENEMY.gltf-b34d11058e00cbb005301d0c8ab6a98b.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Enemies/Models/DISSAPPEARING ENEMY.gltf"
|
||||
dest_files=["res://.godot/imported/DISSAPPEARING ENEMY.gltf-b34d11058e00cbb005301d0c8ab6a98b.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type="Node3D"
|
||||
nodes/root_name="Scene Root"
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/embedded_image_handling=1
|
||||
@@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=58 format=3 uid="uid://dahp73fwld24h"]
|
||||
[gd_scene load_steps=59 format=3 uid="uid://dahp73fwld24h"]
|
||||
|
||||
[ext_resource type="Script" path="res://Enemies/Scripts/RangedEnemy.cs" id="1_01lvj"]
|
||||
[ext_resource type="PackedScene" uid="uid://rlxnnw4yay7e" path="res://Enemies/Attacks/EnemyBullet.tscn" id="3_qenx3"]
|
||||
[ext_resource type="Script" path="res://Enemies/Attacks/FireAtPlayer.cs" id="3_qt2md"]
|
||||
[ext_resource type="PackedScene" uid="uid://b1j0g6ikmnibm" path="res://Enemies/HPComponent.tscn" id="4_1vt55"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_dm3u7"]
|
||||
size = Vector3(0.721796, 2.37333, 0.564825)
|
||||
@@ -890,11 +891,12 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_j7wsk")
|
||||
|
||||
[node name="CharacterBody" type="CharacterBody3D" groups=["Enemy"]]
|
||||
[node name="CharacterBody" type="CharacterBody3D" node_paths=PackedStringArray("_hp") groups=["Enemy"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.257979, 0)
|
||||
collision_layer = 0
|
||||
collision_mask = 9
|
||||
script = ExtResource("1_01lvj")
|
||||
_hp = NodePath("HP Component")
|
||||
|
||||
[node name="Timer" type="Timer" parent="." node_paths=PackedStringArray("_enemy")]
|
||||
wait_time = 3.0
|
||||
@@ -1054,4 +1056,7 @@ cast_shadow = 0
|
||||
mesh = SubResource("ArrayMesh_lu7e3")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="HP Component" parent="." instance=ExtResource("4_1vt55")]
|
||||
MaximumHP = 2
|
||||
|
||||
[connection signal="timeout" from="Timer" to="Timer" method="OnFireAtPlayer"]
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
public partial class BasicEnemy : Node3D
|
||||
{
|
||||
[Export]
|
||||
private HealthPoints _hp;
|
||||
|
||||
protected GameManager _gameManager;
|
||||
|
||||
public override void _Ready()
|
||||
@@ -11,8 +14,13 @@ public partial class BasicEnemy : Node3D
|
||||
|
||||
public void OnEnemyHit(Node3D node)
|
||||
{
|
||||
var currentLevel = (Level)GetTree().GetFirstNodeInGroup("Level");
|
||||
currentLevel.OnEnemyDefeated(this);
|
||||
QueueFree();
|
||||
_hp.TakeDamage(1);
|
||||
|
||||
if (_hp.CurrentHP <= 0)
|
||||
{
|
||||
var currentLevel = (Level)GetTree().GetFirstNodeInGroup("Level");
|
||||
currentLevel.OnEnemyDefeated(this);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,15 @@ public partial class GodCircuit : Node3D
|
||||
[Export]
|
||||
private AnimationPlayer _animationPlayer;
|
||||
|
||||
[Signal]
|
||||
public delegate void OnEnemyBossHitEventHandler(long damage);
|
||||
|
||||
private void OnHit(Node3D node)
|
||||
{
|
||||
GD.Print("Hit");
|
||||
_animationPlayer.Play("OnHit");
|
||||
var hpComponent = GetNode<HealthPoints>("HP Component");
|
||||
hpComponent.TakeDamage(800000);
|
||||
hpComponent.UpdateHealthbar();
|
||||
if (hpComponent.CurrentHP <= 0)
|
||||
QueueFree();
|
||||
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user