7-14-25 1:27PM

This commit is contained in:
2025-07-14 13:27:07 -04:00
parent 0a5f6be26d
commit be4a1fc794
16 changed files with 291 additions and 106 deletions

View File

@@ -4,18 +4,28 @@ using System;
public partial class Cue : Sprite2D
{
[Signal]
public delegate void ShootEventHandler(Vector2 impulse);
public delegate void ShootEventHandler(Vector2 IMPULSE);
public bool _shown;
public int _powerDirection = 1;
public float _power = 0.0f, _maxPower = 8.0f;
public ProgressBar _progressBar;
public override void _Ready()
public static Cue Create(string SCENENAME)
{
_progressBar = GetParent().GetNode<ProgressBar>("PowerBar");
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/"+SCENENAME+".tscn");
Cue newCue = scene.Instantiate<Cue>();
Texture2D image = GD.Load<Texture2D>("res://art/cue.png");
newCue.Texture = image;
return newCue;
}
public override void _Process(double delta_)
public override void _Ready()
{
//_progressBar = GetParent().GetNode<ProgressBar>("PowerBar");
}
public override void _Process(double DELTA_)
{
Vector2 mousePosition = GetViewport().GetMousePosition();
LookAt(mousePosition);
@@ -46,19 +56,20 @@ public partial class Cue : Sprite2D
public void HideCue()
{
_shown = false;
SetProcess(false);
Hide();
_progressBar.Hide();
//_progressBar.Hide();
}
public void ShowCue()
public void ShowCue(Ball CUEBALL)
{
Ball cueBall = GetParent().GetNode<Ball>("CueBall");
_shown = true;
SetProcess(true);
Position = cueBall.Position;
_progressBar.Position = new Vector2(cueBall.Position.X - _progressBar.Size.X / 2, cueBall.Position.Y + _progressBar.Size.Y / 2);
Position = CUEBALL.Position;
//_progressBar.Position = new Vector2(CUEBALL.Position.X - _progressBar.Size.X / 2, CUEBALL.Position.Y + _progressBar.Size.Y / 2);
Show();
_progressBar.Show();
//_progressBar.Show();
}
}