mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-17 02:53:48 +00:00
Boss phase animations
This commit is contained in:
parent
1db132d77d
commit
b4fdb9c9e3
8 changed files with 90 additions and 9 deletions
|
|
@ -38,6 +38,7 @@ overrides = {
|
||||||
"box_size": "Vector2(300, 50)",
|
"box_size": "Vector2(300, 50)",
|
||||||
"name_label_custom_font_size": "8.0",
|
"name_label_custom_font_size": "8.0",
|
||||||
"name_label_use_global_font_size": "false",
|
"name_label_use_global_font_size": "false",
|
||||||
|
"next_indicator_size": "Vector2(12, 12)",
|
||||||
"text_size": "6.0",
|
"text_size": "6.0",
|
||||||
"text_use_global_size": "false"
|
"text_use_global_size": "false"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,5 @@ WaitForCompletion = true
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("3_o6234")
|
script = ExtResource("3_o6234")
|
||||||
Threshold = 900
|
Threshold = 900
|
||||||
|
PlayAnimation = true
|
||||||
Patterns = Array[Resource]([SubResource("Resource_upj22"), SubResource("Resource_gm1rv"), SubResource("Resource_5fq8v"), SubResource("Resource_gm1rv")])
|
Patterns = Array[Resource]([SubResource("Resource_upj22"), SubResource("Resource_gm1rv"), SubResource("Resource_5fq8v"), SubResource("Resource_gm1rv")])
|
||||||
|
|
|
||||||
|
|
@ -39,5 +39,6 @@ WaitForCompletion = false
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_0cgch")
|
script = ExtResource("1_0cgch")
|
||||||
Threshold = 999
|
Threshold = 990
|
||||||
|
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")])
|
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")])
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
[gd_scene load_steps=13 format=3 uid="uid://d1rlw6ddpmrn8"]
|
[gd_scene load_steps=14 format=3 uid="uid://d1rlw6ddpmrn8"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Scripts/Actors/Boss.cs" id="1_na4uq"]
|
[ext_resource type="Script" path="res://Scripts/Actors/Boss.cs" id="1_na4uq"]
|
||||||
[ext_resource type="Resource" uid="uid://ks6fypeil6gk" path="res://Resources/BossPhases/TestBoss1.tres" id="2_1rhf6"]
|
[ext_resource type="Resource" uid="uid://ks6fypeil6gk" path="res://Resources/BossPhases/TestBoss1.tres" id="2_1rhf6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bcqgke6dthlrj" path="res://Sprites/Actors/Rumia.png" id="2_7k5gp"]
|
[ext_resource type="Texture2D" uid="uid://bcqgke6dthlrj" path="res://Sprites/Actors/Rumia.png" id="2_7k5gp"]
|
||||||
[ext_resource type="Script" path="res://Scripts/Components/ProximityPlayerDetection.cs" id="3_gka5j"]
|
[ext_resource type="Script" path="res://Scripts/Components/ProximityPlayerDetection.cs" id="3_gka5j"]
|
||||||
[ext_resource type="Resource" uid="uid://ccj0cqbveey8c" path="res://Resources/BossPhases/Rumia_SP1.tres" id="3_j7lbl"]
|
[ext_resource type="Resource" uid="uid://ccj0cqbveey8c" path="res://Resources/BossPhases/Rumia_SP1.tres" id="3_j7lbl"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://csuprfskdo1qp" path="res://Sprites/Portraits/Rumia.png" id="4_at5iq"]
|
||||||
[ext_resource type="PackedScene" uid="uid://crry0rgk7a8sm" path="res://Scenes/Weapons/BaseWeapon.tscn" id="4_xc6nm"]
|
[ext_resource type="PackedScene" uid="uid://crry0rgk7a8sm" path="res://Scenes/Weapons/BaseWeapon.tscn" id="4_xc6nm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cuixq5ex0j40h" path="res://Scenes/enemyBullet.tscn" id="5_g1p0m"]
|
[ext_resource type="PackedScene" uid="uid://cuixq5ex0j40h" path="res://Scenes/enemyBullet.tscn" id="5_g1p0m"]
|
||||||
[ext_resource type="Script" path="res://Scripts/Components/BulletSpawner.cs" id="7_2obh7"]
|
[ext_resource type="Script" path="res://Scripts/Components/BulletSpawner.cs" id="7_2obh7"]
|
||||||
|
|
@ -26,6 +27,7 @@ collision_layer = 16
|
||||||
collision_mask = 9
|
collision_mask = 9
|
||||||
script = ExtResource("1_na4uq")
|
script = ExtResource("1_na4uq")
|
||||||
Phases = Array[Resource]([ExtResource("2_1rhf6"), ExtResource("3_j7lbl")])
|
Phases = Array[Resource]([ExtResource("2_1rhf6"), ExtResource("3_j7lbl")])
|
||||||
|
_bossPortraitTexture = ExtResource("4_at5iq")
|
||||||
Health = 1000.0
|
Health = 1000.0
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using Cirno.Scripts.Resources;
|
using System.Threading.Tasks;
|
||||||
|
using Cirno.Scripts.Resources;
|
||||||
|
using Cirno.Scripts.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Godot.Collections;
|
using Godot.Collections;
|
||||||
|
|
||||||
|
|
@ -12,13 +14,18 @@ public partial class Boss : Enemy, IActivable
|
||||||
private bool _started = false;
|
private bool _started = false;
|
||||||
|
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
|
public GameManager GameManager => _gameManager;
|
||||||
private Vector2 _homePosition;
|
private Vector2 _homePosition;
|
||||||
public Vector2 HomePosition => _homePosition;
|
public Vector2 HomePosition => _homePosition;
|
||||||
|
|
||||||
public GameManager GameManager => _gameManager;
|
|
||||||
|
|
||||||
private BossPhase CurrentPhase => Phases[currentPhaseIndex];
|
private BossPhase CurrentPhase => Phases[currentPhaseIndex];
|
||||||
|
|
||||||
|
// [Export]
|
||||||
|
// private PackedScene _bossPhaseAnimationPrefab;
|
||||||
|
|
||||||
|
private TextureRect _animationTextureRect;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
private Texture2D _bossPortraitTexture;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
|
@ -26,6 +33,29 @@ public partial class Boss : Enemy, IActivable
|
||||||
_gameManager = this.GetGameManager();
|
_gameManager = this.GetGameManager();
|
||||||
|
|
||||||
_homePosition = this.GlobalPosition;
|
_homePosition = this.GlobalPosition;
|
||||||
|
|
||||||
|
if (_bossPortraitTexture is not null)
|
||||||
|
{
|
||||||
|
var canvas = new CanvasLayer();
|
||||||
|
canvas.Name = "BossPhaseAnimationCanvas";
|
||||||
|
|
||||||
|
_gameManager.CallDeferred("add_child", canvas);
|
||||||
|
|
||||||
|
_animationTextureRect = new TextureRect();
|
||||||
|
_animationTextureRect.Texture = _bossPortraitTexture;
|
||||||
|
|
||||||
|
canvas.CallDeferred("add_child", _animationTextureRect);
|
||||||
|
|
||||||
|
//canvas.AddChild(animationTextureRect);
|
||||||
|
|
||||||
|
_animationTextureRect.Position = new Vector2(180, 10);
|
||||||
|
|
||||||
|
_animationTextureRect.Visible = false;
|
||||||
|
|
||||||
|
//var animation = _bossPhaseAnimationPrefab.Instantiate<BossPhaseAnimation>();
|
||||||
|
|
||||||
|
// _gameManager.AddChild(animation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
|
|
@ -45,7 +75,14 @@ public partial class Boss : Enemy, IActivable
|
||||||
|
|
||||||
private void StartPhase(BossPhase phase)
|
private void StartPhase(BossPhase phase)
|
||||||
{
|
{
|
||||||
phase.Start(this);
|
if (phase.PlayAnimation)
|
||||||
|
{
|
||||||
|
_ = Switchphase(phase);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
phase.Start(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TakeDamage(int amount)
|
public void TakeDamage(int amount)
|
||||||
|
|
@ -60,4 +97,34 @@ public partial class Boss : Enemy, IActivable
|
||||||
_started = true;
|
_started = true;
|
||||||
StartPhase(CurrentPhase);
|
StartPhase(CurrentPhase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task Switchphase(BossPhase phase)
|
||||||
|
{
|
||||||
|
await PlayAnimation();
|
||||||
|
|
||||||
|
phase.Start(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task PlayAnimation()
|
||||||
|
{
|
||||||
|
_animationTextureRect.Modulate = new Color(_animationTextureRect.Modulate.R, _animationTextureRect.Modulate.G, _animationTextureRect.Modulate.B, 0f);
|
||||||
|
_animationTextureRect.Visible = true;
|
||||||
|
|
||||||
|
var tween = GetTree().CreateTween();
|
||||||
|
tween.SetEase(Tween.EaseType.InOut);
|
||||||
|
tween.SetTrans(Tween.TransitionType.Linear);
|
||||||
|
|
||||||
|
tween.TweenProperty(_animationTextureRect, "modulate:a", 1f, 0.2f);
|
||||||
|
|
||||||
|
tween.TweenProperty(_animationTextureRect, "global_position", _animationTextureRect.GlobalPosition + new Vector2(-64f, 20f), 1.5f);
|
||||||
|
|
||||||
|
tween.TweenProperty(_animationTextureRect, "modulate:a", 0f, 0.2f);
|
||||||
|
|
||||||
|
//await Task.Delay(800);
|
||||||
|
|
||||||
|
// Wait for the tween to finish
|
||||||
|
await ToSignal(tween, "finished");
|
||||||
|
|
||||||
|
_animationTextureRect.Visible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -29,7 +29,7 @@ public partial class Hud : CanvasLayer
|
||||||
[Export] private LabelSettings _labelSettings;
|
[Export] private LabelSettings _labelSettings;
|
||||||
|
|
||||||
private Dictionary<string, HudItem> _items = new();
|
private Dictionary<string, HudItem> _items = new();
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
// Assuming the HUD has a Label node named "HealthLabel"
|
// Assuming the HUD has a Label node named "HealthLabel"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ namespace Cirno.Scripts.Resources;
|
||||||
public partial class BossPhase : Resource
|
public partial class BossPhase : Resource
|
||||||
{
|
{
|
||||||
[Export] public int Threshold;
|
[Export] public int Threshold;
|
||||||
|
[Export] public bool PlayAnimation;
|
||||||
[Export] public Array<AttackPattern> Patterns;
|
[Export] public Array<AttackPattern> Patterns;
|
||||||
|
|
||||||
private int currentPatternIndex = 0;
|
private int currentPatternIndex = 0;
|
||||||
|
|
|
||||||
8
Scripts/UI/BossPhaseAnimation.cs
Normal file
8
Scripts/UI/BossPhaseAnimation.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Cirno.Scripts.UI;
|
||||||
|
|
||||||
|
public partial class BossPhaseAnimation : TextureRect
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue