mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 01:05:53 +00:00
Boss Animation
This commit is contained in:
parent
2e01cd19e2
commit
08cc298a81
9 changed files with 139 additions and 13 deletions
42
Scripts/Components/Actors/BossSpriteAnimator.cs
Normal file
42
Scripts/Components/Actors/BossSpriteAnimator.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using Cirno.Scripts.Actors;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors;
|
||||
|
||||
public partial class BossSpriteAnimator : Node2D
|
||||
{
|
||||
[Export]
|
||||
public AnimatedSprite2D AnimatedSprite2D { get; private set; }
|
||||
|
||||
[Export]
|
||||
public Boss Enemy { get; private set; }
|
||||
|
||||
[Export] public StringName NeutralAnimationName { get; private set; } = "default";
|
||||
|
||||
[Export]
|
||||
public StringName LeftAnimationName { get; private set; } = "left";
|
||||
|
||||
[Export]
|
||||
public StringName RightAnimationName { get; private set; } = "right";
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Enemy.ActorSpriteChange += EnemyOnActorSpriteChange;
|
||||
}
|
||||
|
||||
private void EnemyOnActorSpriteChange(Vector2 direction)
|
||||
{
|
||||
if (direction == Vector2.Zero)
|
||||
{
|
||||
AnimatedSprite2D.Play(NeutralAnimationName);
|
||||
}
|
||||
else if (direction.X > 0)
|
||||
{
|
||||
AnimatedSprite2D.Play(RightAnimationName);
|
||||
}
|
||||
else if (direction.X < 0)
|
||||
{
|
||||
AnimatedSprite2D.Play(LeftAnimationName);
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/Actors/BossSpriteAnimator.cs.uid
Normal file
1
Scripts/Components/Actors/BossSpriteAnimator.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dtg2vhquyrib3
|
||||
Loading…
Add table
Add a link
Reference in a new issue