mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 02:25:54 +00:00
Hitbox visible
This commit is contained in:
parent
88fb08a451
commit
0ccc272ada
10 changed files with 141 additions and 17 deletions
|
|
@ -44,6 +44,8 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
|
||||
private GameManager _gameManager;
|
||||
|
||||
[Export] public Sprite2D HitboxSprite { get; set; }
|
||||
|
||||
private bool _isStrafing { get; set; }
|
||||
|
||||
[Signal]
|
||||
|
|
@ -192,10 +194,30 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
|
||||
}
|
||||
|
||||
// public override void _Draw()
|
||||
// {
|
||||
// if (_isStrafing)
|
||||
// {
|
||||
// HitboxSprite.Visible = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// HitboxSprite.Visible = false;
|
||||
// }
|
||||
// base._Draw();
|
||||
// }
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
_movementDirection = GetInput();
|
||||
|
||||
_isStrafing = Input.IsActionPressed("strafe");
|
||||
// Toggle visibility of the hitbox sprite based on strafing
|
||||
if (HitboxSprite != null)
|
||||
{
|
||||
HitboxSprite.Visible = _isStrafing;
|
||||
}
|
||||
|
||||
_rightStickInput = GetRightStickInput();
|
||||
|
||||
// Update Facing Direction
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue