mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-04 13:55:55 +00:00
Scriptable bullet emitter
This commit is contained in:
parent
d62538a382
commit
4261009c33
17 changed files with 251 additions and 74 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using Cirno.Scripts.Actors;
|
||||
using Cirno.Scripts.AttackPatterns;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources;
|
||||
|
|
@ -14,16 +15,22 @@ public partial class SimpleMovementPattern : AttackPattern
|
|||
private Tween tween;
|
||||
private bool isComplete = false;
|
||||
|
||||
public override void Start(Boss boss)
|
||||
protected IScriptHost Boss;
|
||||
|
||||
public override void Start(Node2D parent)
|
||||
{
|
||||
Parent = parent;
|
||||
if (parent is not IScriptHost boss)
|
||||
return;
|
||||
|
||||
Boss = boss;
|
||||
tween = boss.CreateTween();
|
||||
tween = Parent.CreateTween();
|
||||
isComplete = false;
|
||||
|
||||
Vector2 targetPosition = (Boss?.HomePosition ?? boss.GlobalPosition) + relativeTargetPosition;
|
||||
Vector2 targetPosition = (Boss?.HomePosition ?? Parent.GlobalPosition) + relativeTargetPosition;
|
||||
|
||||
boss.ChangeSpriteDirection(-(boss.GlobalPosition - targetPosition));
|
||||
tween.TweenProperty(Boss, "global_position", targetPosition, moveDuration)
|
||||
boss.ChangeSpriteDirection(-(Parent.GlobalPosition - targetPosition));
|
||||
tween.TweenProperty(Parent, "global_position", targetPosition, moveDuration)
|
||||
.SetTrans(transitionType)
|
||||
.SetEase(easeType)
|
||||
.Finished += () =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue