Directional spider bomb

This commit is contained in:
MaddoScientisto 2025-03-15 17:56:55 +01:00
commit 36e77adcd7
8 changed files with 44 additions and 6 deletions

View file

@ -8,7 +8,11 @@ public partial class Active : PlayerStateBase
{
public override PlayerState StateId => PlayerState.Active;
private Vector2 _movementDirection { get; set; }
public Vector2 FacingDirection { get; private set; } = Vector2.Down;
public Vector2 FacingDirection
{
get => _storageModule.FacingDirection;
private set => _storageModule.FacingDirection = value;
}
[Export]
public int Speed { get; set; } = 45;
@ -32,6 +36,8 @@ public partial class Active : PlayerStateBase
[Export] private ActivationProvider _activationProvider;
[Export] private InteractionController _interactionController;
[Export] private PlayerStorageModule _storageModule;
private bool _isStrafing;

View file

@ -10,8 +10,12 @@ public partial class Init : PlayerStateBase
[Export]
private PlayerAnimationProvider _animationProvider;
[Export] private PlayerStorageModule _storageModule;
public override void EnterState()
{
_storageModule.FacingDirection = ((PlayerStateMachine)StateMachine).StartingDirection;
_animationProvider.PlayUnteleportAnimation();
_ = AutoSwitchToStart();
}

View file

@ -13,6 +13,14 @@ public partial class PlayerFSMItemUseModule : ModuleBase<PlayerState, CharacterB
[Export]
public ActorResourceProvider Shield { get; set; }
[Export] private PlayerStorageModule _storageModule;
public Vector2 FacingDirection
{
get => _storageModule.FacingDirection;
private set => _storageModule.FacingDirection = value;
}
public bool Enabled { get; set; } = false;
public override void EnterState(PlayerState state)
@ -105,7 +113,8 @@ public partial class PlayerFSMItemUseModule : ModuleBase<PlayerState, CharacterB
var bulletData = item.WeaponData.MakeBullet(this.GlobalPosition);
bullet.Initialize(bulletData, GameManager.Instance);
bullet.SetDirection(FacingDirection);
bullet.RotateSpriteDegrees(-90);
//bullet.SetDirection(_facingDirection);
bullet.Speed = item.WeaponData.BulletData.BulletSpeed;

View file

@ -0,0 +1,8 @@
using Godot;
namespace Cirno.Scripts.Components.FSM.Player;
public partial class PlayerStorageModule : Node2D
{
public Vector2 FacingDirection { get; set; }
}

View file

@ -0,0 +1 @@
uid://dbxbvjonbtib2

View file

@ -7,6 +7,8 @@ public partial class PlayerStateMachine : StateMachineBase<PlayerState, Characte
{
[Export] public override PlayerState InitialState { get; protected set; } = PlayerState.Init;
[Export] public Vector2 StartingDirection { get; set; } = Vector2.Down;
public void RefillHealth()
{
GD.Print("Refilling health");