adding in some example pegs and their actions. organizing folders, still working on pathing for some reason it won't move sometimes, and causes the looping to break

This commit is contained in:
2026-06-26 02:36:01 -04:00
parent fc32baa071
commit 350d2bc4d1
33 changed files with 366 additions and 165 deletions
+20 -20
View File
@@ -6,18 +6,18 @@ public partial class Commander : Sprite2D
[Signal]
public delegate void ActionsUpEventHandler();
public int _actionsMax = 1, _actions;
public PackedScene _attackScene = GD.Load<PackedScene>("res://Attack.tscn");
public Attack _attack;
public PackedScene _ballScene = GD.Load<PackedScene>("res://Ball.tscn");
public Ball _ball;
public PlayerController _playerController;
public override void _Process(double delta)
{
base._Process(delta);
if (_attack != null)
if (_ball != null)
{
if (_attack.Position.Y > GetViewportRect().Size.Y + 50)
if (_ball.Position.Y > GetViewportRect().Size.Y + 50)
{
UnloadAttack();
UnloadBall();
if (_actions <= 0)
{
EmitSignal(SignalName.ActionsUp);
@@ -26,34 +26,34 @@ public partial class Commander : Sprite2D
}
}
public void AttackEnteredBucket()
public void BallEnteredBucket()
{
_actions += (_actions + 1) > _actionsMax ? 0 : 1;
UnloadAttack();
UnloadBall();
}
public void LoadAttack(Vector2 OFFSET)
public void LoadBall(Vector2 OFFSET)
{
if (_attack == null)
if (_ball == null)
{
_attack = _attackScene.Instantiate<Attack>();
_attack.Position = OFFSET;
_attack._commanderOwner = this;
_attack.GravityScale = 0;
_attack.BucketEntered += AttackEnteredBucket;
AddChild(_attack);
_ball = _ballScene.Instantiate<Ball>();
_ball.Position = OFFSET;
_ball._commanderOwner = this;
_ball.GravityScale = 0;
_ball.BucketEntered += BallEnteredBucket;
AddChild(_ball);
}
}
public void ShootCurrentAttack(Vector2 FORCE){
public void ShootCurrentBall(Vector2 FORCE){
_attack.Shoot(FORCE);
_ball.Shoot(FORCE);
_actions--;
}
public void UnloadAttack()
public void UnloadBall()
{
_attack.QueueFree();
_attack = null;
_ball.QueueFree();
_ball = null;
}
}