fun stuff

This commit is contained in:
GameJammer
2023-09-14 14:17:27 -07:00
parent 568eb9e6e0
commit 54b044142d
22 changed files with 532 additions and 257 deletions

View File

@@ -200,6 +200,7 @@ resource_name = "Material.001"
cull_mode = 2
vertex_color_use_as_albedo = true
albedo_texture = ExtResource("2_2fhjk")
metallic_specular = 0.0
[sub_resource type="ArrayMesh" id="ArrayMesh_f3cka"]
_surfaces = [{
@@ -235,11 +236,10 @@ shadow_mesh = SubResource("ArrayMesh_f3cka")
render_priority = 0
shader = ExtResource("3_05w5o")
[node name="God Circuit" type="Node3D" node_paths=PackedStringArray("_animationPlayer", "_attackTimer")]
[node name="God Circuit" type="Node3D" node_paths=PackedStringArray("_animationPlayer")]
transform = Transform3D(1, 0, 0, 0, 0.877012, 0.480468, 0, -0.480468, 0.877012, 0, 1.29734, 0)
script = ExtResource("1_gyfww")
_animationPlayer = NodePath("AnimationPlayer")
_attackTimer = NodePath("")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {

View File

@@ -9,12 +9,12 @@ public partial class HealthPoints : Node
public override void _Ready()
{
CurrentHP = MaximumHP;
CurrentHP = MaximumHP;
}
public void TakeDamage(long damage)
{
CurrentHP -= damage;
GD.Print(CurrentHP);
CurrentHP -= damage;
GD.Print(CurrentHP);
}
}

View File

@@ -18,45 +18,45 @@ public partial class GodCircuit : Node3D
private void OnHit(Node3D node)
{
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
{
GD.Print("Player hit: " + character.Name);
character.Call(Character.MethodName.OnHit, node);
}
else
{
var hpComponent = GetNode<HealthPoints>("HP Component");
if (hpComponent.CurrentHP > 0)
{
GD.Print("Hit");
_animationPlayer.Play("OnHit");
hpComponent.TakeDamage(800000);
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
{
GD.Print("Player hit: " + character.Name);
character.Call(Character.MethodName.OnHit, node);
}
else
{
var hpComponent = GetNode<HealthPoints>("HP Component");
if (hpComponent.CurrentHP > 0)
{
GD.Print("Hit");
_animationPlayer.Play("OnHit");
hpComponent.TakeDamage(800000);
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
if (hpComponent.CurrentHP <= 0)
{
EmitSignal(SignalName.DestroyRemainingOrbs);
_animationPlayer.Play("OnDeath");
_animationPlayer.AnimationFinished += OnGameFinished;
}
}
}
if (hpComponent.CurrentHP <= 0)
{
EmitSignal(SignalName.DestroyRemainingOrbs);
_animationPlayer.Play("OnDeath");
_animationPlayer.AnimationFinished += OnGameFinished;
}
}
}
}
private void OnBossOrbDestroyed()
{
var hpComponent = GetNode<HealthPoints>("HP Component");
_animationPlayer.Play("OnHit");
hpComponent.TakeDamage(30000000);
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
var hpComponent = GetNode<HealthPoints>("HP Component");
_animationPlayer.Play("OnHit");
hpComponent.TakeDamage(30000000);
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
if (hpComponent.CurrentHP <= 0)
hpComponent.CurrentHP = 1;
if (hpComponent.CurrentHP <= 0)
hpComponent.CurrentHP = 1;
}
private void OnGameFinished(StringName animationName)
{
QueueFree();
EmitSignal(SignalName.OnGameEnding);
QueueFree();
EmitSignal(SignalName.OnGameEnding);
}
}