Add attack patterns for boss
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
using Godot;
|
||||
|
||||
public partial class EnemyBullet : Projectile
|
||||
{
|
||||
public new void OnProjectileHit(Node node)
|
||||
{
|
||||
SetPhysicsProcess(false);
|
||||
|
||||
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
|
||||
{
|
||||
GD.Print("Player hit: " + character.Name);
|
||||
character.Call(Character.MethodName.OnHit, this);
|
||||
}
|
||||
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://rlxnnw4yay7e"]
|
||||
|
||||
[ext_resource type="Script" path="res://Enemies/Attacks/EnemyBullet.cs" id="1_rv13r"]
|
||||
[ext_resource type="Script" path="res://Player/Base/Projectile.cs" id="1_ex3g8"]
|
||||
[ext_resource type="Texture2D" uid="uid://dd71tdgrgic46" path="res://Textures/Projectiles/LB ORB.png" id="2_6l2aj"]
|
||||
|
||||
[sub_resource type="Curve3D" id="Curve3D_eve6n"]
|
||||
@@ -16,7 +16,7 @@ radius = 0.154574
|
||||
|
||||
[node name="EnemyBullet" type="Path3D"]
|
||||
curve = SubResource("Curve3D_eve6n")
|
||||
script = ExtResource("1_rv13r")
|
||||
script = ExtResource("1_ex3g8")
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
@@ -51,4 +51,4 @@ process_callback = 0
|
||||
wait_time = 0.8
|
||||
autostart = true
|
||||
|
||||
[connection signal="body_entered" from="PathFollow3D/RigidBody3D" to="." method="OnProjectileHit"]
|
||||
[connection signal="body_entered" from="PathFollow3D/RigidBody3D" to="." method="OnPlayerHit"]
|
||||
|
||||
@@ -19,7 +19,7 @@ public partial class FireAtPlayer : Timer
|
||||
var target = convertedPlayers.OrderBy(x => _enemy.Position.DistanceTo(x.Position)).FirstOrDefault();
|
||||
if (_enemy.Position.DistanceTo(target.Position) < _distanceToPlayer)
|
||||
{
|
||||
var projectile = _fireProjectile.Instantiate<Projectile>() as EnemyBullet;
|
||||
var projectile = _fireProjectile.Instantiate<Projectile>();
|
||||
projectile.Rotation = new Vector3(0, _enemy.Rotation.Y, 0);
|
||||
projectile.Position = _enemy.Position;
|
||||
AddChild(projectile);
|
||||
|
||||
26
Enemies/Attacks/GodCircuitAttacks/GodCircuitAttacks.cs
Normal file
26
Enemies/Attacks/GodCircuitAttacks/GodCircuitAttacks.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using System.Linq;
|
||||
|
||||
public partial class GodCircuitAttacks : Timer
|
||||
{
|
||||
[Export]
|
||||
public Array<PackedScene> _attacks;
|
||||
|
||||
private int _currentAttack = 0;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (GetTree().GetFirstNodeInGroup("Player") != null)
|
||||
Paused = false;
|
||||
else
|
||||
Paused = true;
|
||||
}
|
||||
|
||||
public void OnTimeout()
|
||||
{
|
||||
_currentAttack = GD.RandRange(0, _attacks.Count - 1);
|
||||
var attack = _attacks.ElementAt(_currentAttack).Instantiate();
|
||||
AddChild(attack);
|
||||
}
|
||||
}
|
||||
47
Enemies/Attacks/GodCircuitAttacks/LaserAttack.tscn
Normal file
47
Enemies/Attacks/GodCircuitAttacks/LaserAttack.tscn
Normal file
@@ -0,0 +1,47 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://uwia12i7yykb"]
|
||||
|
||||
[ext_resource type="Script" path="res://Player/Base/Projectile.cs" id="1_4wsx3"]
|
||||
[ext_resource type="Texture2D" uid="uid://blhihtd4vmbrg" path="res://Textures/Projectiles/Layer 7.png" id="1_odish"]
|
||||
|
||||
[sub_resource type="Curve3D" id="Curve3D_5bny4"]
|
||||
_data = {
|
||||
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -8),
|
||||
"tilts": PackedFloat32Array(0, 0)
|
||||
}
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_54g6d"]
|
||||
size = Vector3(1, 4.3194, 1.42031)
|
||||
|
||||
[node name="Laser Attack" type="Path3D"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -3, 0, 1.5)
|
||||
curve = SubResource("Curve3D_5bny4")
|
||||
script = ExtResource("1_4wsx3")
|
||||
_projectileSpeed = 3.0
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
rotation_mode = 0
|
||||
loop = false
|
||||
|
||||
[node name="RigidBody3D" type="RigidBody3D" parent="PathFollow3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.944978)
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
continuous_cd = true
|
||||
max_contacts_reported = 5
|
||||
contact_monitor = true
|
||||
can_sleep = false
|
||||
freeze = true
|
||||
freeze_mode = 1
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="PathFollow3D/RigidBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.38419e-07, 0, 1.78244)
|
||||
shape = SubResource("BoxShape3D_54g6d")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="PathFollow3D/RigidBody3D/CollisionShape3D"]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
axis = 1
|
||||
texture = ExtResource("1_odish")
|
||||
|
||||
[connection signal="body_entered" from="PathFollow3D/RigidBody3D" to="." method="OnPlayerHit"]
|
||||
46
Enemies/Attacks/GodCircuitAttacks/OrbAttack.tscn
Normal file
46
Enemies/Attacks/GodCircuitAttacks/OrbAttack.tscn
Normal file
@@ -0,0 +1,46 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cerac64r5jewa"]
|
||||
|
||||
[ext_resource type="Script" path="res://Player/Base/Projectile.cs" id="1_cveok"]
|
||||
[ext_resource type="Texture2D" uid="uid://cpvq0rru8k7l5" path="res://Textures/Projectiles/Layer 3.png" id="1_p5wrg"]
|
||||
|
||||
[sub_resource type="Curve3D" id="Curve3D_h1xf0"]
|
||||
_data = {
|
||||
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 1, -1, 0, 0, 0, 0, 0, 0, 0, 1, -5, 0, 0, 0, 0, 0, 0, -2, 1, -1, 0, 0, 0, 0, 0, 0, 0, 1, 0),
|
||||
"tilts": PackedFloat32Array(0, 0, 0, 0, 0)
|
||||
}
|
||||
point_count = 5
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_o3ugd"]
|
||||
radius = 0.25
|
||||
|
||||
[node name="Orb Attack" type="Path3D"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -3, 0, 1.5)
|
||||
curve = SubResource("Curve3D_h1xf0")
|
||||
script = ExtResource("1_cveok")
|
||||
_projectileSpeed = 1.5
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
rotation_mode = 0
|
||||
|
||||
[node name="RigidBody3D" type="RigidBody3D" parent="PathFollow3D"]
|
||||
transform = Transform3D(1, 0, 7.10543e-15, 0, 1, 0, -7.10543e-15, 0, 1, 0, 0, 0)
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
continuous_cd = true
|
||||
max_contacts_reported = 5
|
||||
contact_monitor = true
|
||||
can_sleep = false
|
||||
freeze = true
|
||||
freeze_mode = 1
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="PathFollow3D/RigidBody3D"]
|
||||
transform = Transform3D(1, 0, 7.10543e-15, 0, 1, 0, -7.10543e-15, 0, 1, 0, 0, 0)
|
||||
shape = SubResource("CylinderShape3D_o3ugd")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="PathFollow3D/RigidBody3D/CollisionShape3D"]
|
||||
transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, 0, 0)
|
||||
axis = 1
|
||||
texture = ExtResource("1_p5wrg")
|
||||
|
||||
[connection signal="body_entered" from="PathFollow3D/RigidBody3D" to="." method="OnPlayerHit"]
|
||||
@@ -1,9 +1,12 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://brbshysbgd47q"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://brbshysbgd47q"]
|
||||
|
||||
[ext_resource type="Script" path="res://Enemies/Scripts/GodCircuit.cs" id="1_gyfww"]
|
||||
[ext_resource type="Texture2D" uid="uid://b41ur7kyd8vdl" path="res://Levels/Models/Stage10/god circuit stage 1_image.png" id="2_2fhjk"]
|
||||
[ext_resource type="Shader" path="res://Levels/Scenes/Door.gdshader" id="3_05w5o"]
|
||||
[ext_resource type="AudioStream" uid="uid://crto2nljfvqnm" path="res://Audio/SFX/midboss hurt.wav" id="4_kc3iq"]
|
||||
[ext_resource type="Script" path="res://Enemies/Attacks/GodCircuitAttacks/GodCircuitAttacks.cs" id="5_hp00m"]
|
||||
[ext_resource type="PackedScene" uid="uid://uwia12i7yykb" path="res://Enemies/Attacks/GodCircuitAttacks/LaserAttack.tscn" id="6_frlsw"]
|
||||
[ext_resource type="PackedScene" uid="uid://cerac64r5jewa" path="res://Enemies/Attacks/GodCircuitAttacks/OrbAttack.tscn" id="7_1t6n0"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_n85p2"]
|
||||
resource_name = "OnHit"
|
||||
@@ -172,7 +175,14 @@ freeze_mode = 1
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 4.30333e-22, 0, 1, 0.317906, -0.678684, 1.59406)
|
||||
shape = SubResource("BoxShape3D_n2erm")
|
||||
|
||||
[node name="Timer" type="Timer" parent="StaticBody3D"]
|
||||
wait_time = 5.0
|
||||
autostart = true
|
||||
script = ExtResource("5_hp00m")
|
||||
_attacks = Array[PackedScene]([ExtResource("7_1t6n0"), ExtResource("6_frlsw")])
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_kc3iq")
|
||||
|
||||
[connection signal="body_entered" from="StaticBody3D" to="." method="OnHit"]
|
||||
[connection signal="timeout" from="StaticBody3D/Timer" to="StaticBody3D/Timer" method="OnTimeout"]
|
||||
|
||||
Reference in New Issue
Block a user