7-17-25 @ 3:55am

This commit is contained in:
2025-07-17 03:55:30 -04:00
parent c5795028f0
commit 3884c07811
23 changed files with 371 additions and 103 deletions

View File

@@ -3,9 +3,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
public partial class Actor : Node
public partial class Actor : Sprite2D
{
public bool _available, _hovered, _selected;
public bool _available = false, _hovered = false, _selected = false;
public int _health, _healthMax;
public CollisionShape2D _startArea;
public List<Cue> _cues = new();
public Cue _selectedCue = null;
@@ -17,34 +18,40 @@ public partial class Actor : Node
public Sprite2D _tempBallSprite = new();
public static Actor Create(string SCENENAME)
public static Actor _Create()
{
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/" + SCENENAME + ".tscn");
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/actor.tscn");
Actor newActor = scene.Instantiate<Actor>();
return newActor;
}
newActor.Texture = GD.Load<Texture2D>("res://art/ness.png");
public override void _Ready()
{
Ball newBall = Ball.Create("ball", 0);
_balls.Add(newBall);
newBall = Ball.Create("ball", 1);
_balls.Add(newBall);
Ball newBall = Ball._Create(0);
newActor._balls.Add(newBall);
newBall = Ball._Create(0);
newActor._balls.Add(newBall);
Cue newCue = Cue.Create("cue");
AddChild(newCue);
_cues.Add(newCue);
for (int i = 0; i < _cues.Count; i++)
Cue newCue = Cue._Create();
newActor.AddChild(newCue);
newActor._cues.Add(newCue);
for (int i = 0; i < newActor._cues.Count; i++)
{
_cues[i].Shoot += OnCueShoot;
newActor._cues[i].Shoot += newActor.OnCueShoot;
}
_ballBag = new(_balls);
newActor._ballBag = new(newActor._balls);
newActor._health = 10;
newActor._healthMax = newActor._health;
ActorPanel newActorPanel = ActorPanel._Create(newActor);
newActor.AddChild(newActorPanel);
return newActor;
}
public override void _Process(double DELTA_)
{
if (_ballBag.Count > 0)
if (_ballBag.Count > 0 && _selected)
{
if (_heldBall == null)
{
@@ -71,7 +78,7 @@ public partial class Actor : Node
{
_startArea = Globals.Instance._currentBattle.GetNode<Table>("Table").GetNode<Area2D>("PlayerStartArea").GetNode<CollisionShape2D>("CollisionShape2D");
}
_tempBallSprite.Position = new Vector2(Math.Min(Math.Max(mousePosition.X, _startArea.GlobalPosition.X - ((RectangleShape2D)(_startArea.Shape)).Size.X / 2), _startArea.GlobalPosition.X + ((RectangleShape2D)(_startArea.Shape)).Size.X / 2), Math.Min(Math.Max(mousePosition.Y, _startArea.GlobalPosition.Y - ((RectangleShape2D)(_startArea.Shape)).Size.Y / 2), _startArea.GlobalPosition.Y + ((RectangleShape2D)(_startArea.Shape)).Size.Y / 2));
if (Input.IsActionJustReleased("left_click"))
{
@@ -133,7 +140,7 @@ public partial class Actor : Node
//public void ResetCueBall()
//{
//_cueBall = Ball.Create("ball", 0, _startPosition);
//_cueBall = Ball._Create("ball", 0, _startPosition);
//_cueBall.SetName("CueBall");
//AddChild(_cueBall);
//Texture2D image = GD.Load<Texture2D>("res://art/cue_ball.png");