mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 02:25:54 +00:00
Fix for phase switch animation
This commit is contained in:
parent
bfdb71dd84
commit
95979bd3b8
7 changed files with 21 additions and 14 deletions
|
|
@ -259,6 +259,6 @@ WaitForCompletion = true
|
|||
[resource]
|
||||
script = ExtResource("1_fdlxv")
|
||||
PhaseName = "Darkness Sign \"Demarcation\""
|
||||
Threshold = 850
|
||||
Threshold = 100
|
||||
PlayAnimation = true
|
||||
Patterns = Array[Object]([SubResource("Resource_puvpt"), SubResource("Resource_44j24"), SubResource("Resource_wkxow"), SubResource("Resource_gcqck"), SubResource("Resource_bxbto"), SubResource("Resource_q48s1"), SubResource("Resource_erexw"), SubResource("Resource_mpjrl"), SubResource("Resource_l05f2"), SubResource("Resource_ncfnl"), SubResource("Resource_q7cr0"), SubResource("Resource_vkthc"), SubResource("Resource_8kl6r"), SubResource("Resource_n2gn4"), SubResource("Resource_ha2b6")])
|
||||
|
|
|
|||
|
|
@ -92,6 +92,6 @@ WaitForCompletion = true
|
|||
[resource]
|
||||
script = ExtResource("3_o6234")
|
||||
PhaseName = "Night Sign \"Night Bird\""
|
||||
Threshold = 900
|
||||
Threshold = 200
|
||||
PlayAnimation = true
|
||||
Patterns = Array[Resource]([SubResource("Resource_upj22"), SubResource("Resource_gm1rv"), SubResource("Resource_5fq8v"), SubResource("Resource_gm1rv"), SubResource("Resource_upj22"), SubResource("Resource_gm1rv"), SubResource("Resource_nl664"), SubResource("Resource_gm1rv")])
|
||||
|
|
|
|||
|
|
@ -40,6 +40,6 @@ WaitForCompletion = false
|
|||
[resource]
|
||||
script = ExtResource("1_0cgch")
|
||||
PhaseName = ""
|
||||
Threshold = 950
|
||||
Threshold = 300
|
||||
PlayAnimation = false
|
||||
Patterns = Array[Resource]([SubResource("Resource_acaax"), ExtResource("2_7n56o"), ExtResource("3_mwcf3"), SubResource("Resource_o8win"), ExtResource("2_7n56o"), ExtResource("3_mwcf3"), SubResource("Resource_k77ig"), ExtResource("2_7n56o"), ExtResource("3_mwcf3"), SubResource("Resource_5ocg5"), ExtResource("2_7n56o"), ExtResource("3_mwcf3")])
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ collision_layer = 16
|
|||
collision_mask = 9
|
||||
script = ExtResource("1_na4uq")
|
||||
BossName = "Rumia"
|
||||
Phases = Array[Resource]([ExtResource("2_eyxw4"), ExtResource("2_1rhf6"), ExtResource("3_j7lbl")])
|
||||
Phases = Array[Resource]([ExtResource("2_1rhf6"), ExtResource("3_j7lbl"), ExtResource("2_eyxw4")])
|
||||
BossHudPrefab = ExtResource("4_ehp8q")
|
||||
_bossPortraitTexture = ExtResource("4_at5iq")
|
||||
Health = 1000.0
|
||||
Health = 400.0
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=54 format=4 uid="uid://bv451a8wgty4u"]
|
||||
[gd_scene load_steps=51 format=4 uid="uid://bv451a8wgty4u"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/GameManager.cs" id="1_8tmoj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"]
|
||||
|
|
@ -41,9 +41,6 @@
|
|||
[ext_resource type="PackedScene" uid="uid://cmr6fclttrpkb" path="res://Scenes/Items/Ammo1.tscn" id="34_17pjh"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0yes7huiyisw" path="res://Scenes/Items/Blue_Keycard.tscn" id="35_rblsn"]
|
||||
[ext_resource type="PackedScene" uid="uid://r25rq6ijgm6m" path="res://Scenes/Items/Green_Keycard.tscn" id="36_f8fh1"]
|
||||
[ext_resource type="Resource" uid="uid://ks6fypeil6gk" path="res://Resources/BossPhases/TestBoss1.tres" id="39_cfwbr"]
|
||||
[ext_resource type="Resource" uid="uid://ccj0cqbveey8c" path="res://Resources/BossPhases/Rumia_SP1.tres" id="40_44asd"]
|
||||
[ext_resource type="Resource" uid="uid://ddb5dqocmk6x7" path="res://Resources/BossPhases/Rumia_NS2.tres" id="41_aqvu2"]
|
||||
[ext_resource type="PackedScene" uid="uid://fxvlaidieiv7" path="res://Scenes/Interactable/ScriptableAreaTrigger.tscn" id="43_kf3qc"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/Events/MovePlayerEvent.cs" id="44_klwgh"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/Events/ActivateEvent.cs" id="45_emjoj"]
|
||||
|
|
@ -342,7 +339,6 @@ disabled = true
|
|||
|
||||
[node name="Rumia" parent="." instance=ExtResource("19_acobs")]
|
||||
position = Vector2(-1483, -499)
|
||||
Phases = Array[Resource]([ExtResource("39_cfwbr"), ExtResource("40_44asd"), ExtResource("41_aqvu2")])
|
||||
|
||||
[node name="Computer" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("31_243ec")]
|
||||
position = Vector2(-794, -127)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public partial class Boss : Enemy, IActivable
|
|||
private int currentPhaseIndex = 0;
|
||||
|
||||
private bool _started = false;
|
||||
private bool _waiting = false;
|
||||
|
||||
private GameManager _gameManager;
|
||||
public GameManager GameManager => _gameManager;
|
||||
|
|
@ -22,7 +23,7 @@ public partial class Boss : Enemy, IActivable
|
|||
private BossPhase CurrentPhase => Phases[currentPhaseIndex];
|
||||
|
||||
private Marker2D _cameraMarker;
|
||||
|
||||
|
||||
[Export]
|
||||
public Vector2 CameraOffset = Vector2.Zero;
|
||||
|
||||
|
|
@ -94,6 +95,7 @@ public partial class Boss : Enemy, IActivable
|
|||
base._Process(delta);
|
||||
|
||||
if (!_started) return;
|
||||
if (_waiting) return;
|
||||
|
||||
CurrentPhase.UpdatePhase(delta);
|
||||
if (_currentHealth <= CurrentPhase.Threshold && currentPhaseIndex + 1 < Phases.Count)
|
||||
|
|
@ -108,6 +110,8 @@ public partial class Boss : Enemy, IActivable
|
|||
{
|
||||
if (phase.PlayAnimation)
|
||||
{
|
||||
_waiting = true;
|
||||
_invulnerable = true;
|
||||
_ = Switchphase(phase);
|
||||
}
|
||||
else
|
||||
|
|
@ -138,6 +142,8 @@ public partial class Boss : Enemy, IActivable
|
|||
{
|
||||
await PlayAnimation();
|
||||
|
||||
_waiting = false;
|
||||
_invulnerable = false;
|
||||
phase.Start(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,9 @@ public partial class Enemy : CharacterBody2D
|
|||
private bool _isDestroyed = false;
|
||||
|
||||
private NavigationAgent2D _navigationAgent;
|
||||
|
||||
|
||||
protected bool _invulnerable = false;
|
||||
|
||||
private bool IsPlayerInRange => _playerDetection is { IsPlayerInRange: true };
|
||||
|
||||
private bool IsPlayerInSight => _playerDetection is not null && _playerDetection.IsPlayerInSight(CollisionMask);
|
||||
|
|
@ -203,7 +205,9 @@ public partial class Enemy : CharacterBody2D
|
|||
private void _on_damage_hitbox_area_entered(Area2D area)
|
||||
{
|
||||
if (area is not Bullet bullet) return;
|
||||
GD.Print("Enemy Received damage");
|
||||
if (_invulnerable) return;
|
||||
if (bullet.BulletInfo.Owner == BulletOwner.Enemy) return;
|
||||
|
||||
this.Hit(bullet.Damage);
|
||||
bullet.QueueFree();
|
||||
}
|
||||
|
|
@ -225,9 +229,10 @@ public partial class Enemy : CharacterBody2D
|
|||
public void Hit(float damage)
|
||||
{
|
||||
if (_isDestroyed) return;
|
||||
if (_invulnerable) return;
|
||||
|
||||
_currentHealth -= damage;
|
||||
EmitSignal(nameof(HealthChanged), _currentHealth);
|
||||
EmitSignal(SignalName.HealthChanged, _currentHealth);
|
||||
if (!(_currentHealth <= 0)) return;
|
||||
_isDestroyed = true;
|
||||
Explode();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue