7-28-25 @ 11:39pm
This commit is contained in:
@@ -1,181 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Actor : Node2D
|
||||
{
|
||||
public bool _available = false, _hovered = false;
|
||||
public int _health, _healthMax;
|
||||
public CollisionShape2D _startArea;
|
||||
public Cue _cue = null;
|
||||
public List<Ball> _balls = new();
|
||||
public Ball _hoveredBall = null;
|
||||
public Ball _selectedBall = null;
|
||||
public Ball _heldBall = null;
|
||||
public ActorPanel _panel;
|
||||
|
||||
public Sprite2D _tempBallSprite = new();
|
||||
|
||||
public static Actor _Create()
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/actor.tscn");
|
||||
Actor newActor = scene.Instantiate<Actor>();
|
||||
|
||||
newActor.GetNode<Sprite2D>("Sprite").Texture = GD.Load<Texture2D>("res://art/ness.png");
|
||||
|
||||
CueBall newCueBall = CueBall._Create();
|
||||
newActor._balls.Add(newCueBall);
|
||||
|
||||
newCueBall = CueBall._Create();
|
||||
newActor._balls.Add(newCueBall);
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
SupportBall newBall = SupportBall._Create(i+1);
|
||||
newActor._balls.Add(newBall);
|
||||
}
|
||||
|
||||
Cue newCue = Cue._Create();
|
||||
newActor.AddChild(newCue);
|
||||
newActor._cue = newCue;
|
||||
newActor._cue.Shoot += newActor.OnCueShoot;
|
||||
|
||||
newActor._health = 10;
|
||||
newActor._healthMax = newActor._health;
|
||||
|
||||
ActorPanel newActorPanel = ActorPanel._Create(newActor);
|
||||
newActor._panel = newActorPanel;
|
||||
newActor.AddChild(newActorPanel);
|
||||
|
||||
return newActor;
|
||||
}
|
||||
|
||||
public override void _Process(double DELTA_)
|
||||
{
|
||||
// if (_balls.Any(b => !b._placed))
|
||||
// {
|
||||
|
||||
|
||||
// Vector2 mousePosition = GetViewport().GetMousePosition();
|
||||
// if (_tempBallSprite.Texture == null)
|
||||
// {
|
||||
// if (GetChildren().All(n => n != _tempBallSprite))
|
||||
// {
|
||||
// AddChild(_tempBallSprite);
|
||||
// }
|
||||
// _tempBallSprite.Texture = _heldBall.GetNode<Sprite2D>("Image").Texture;
|
||||
// _tempBallSprite.ZIndex = 1;
|
||||
// }
|
||||
// if (_startArea == null)
|
||||
// {
|
||||
// _startArea = Globals.Instance._currentBattle.GetNode<Table>("Table").GetNode<Area2D>("PlayerStartArea").GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
// }
|
||||
|
||||
// _tempBallSprite.Position = mousePosition;
|
||||
// if (_tempBallSprite.Position.X >= _startArea.GlobalPosition.X - ((RectangleShape2D)(_startArea.Shape)).Size.X / 2 && _tempBallSprite.Position.X <= _startArea.GlobalPosition.X + ((RectangleShape2D)(_startArea.Shape)).Size.X / 2 && _tempBallSprite.Position.Y >= _startArea.GlobalPosition.Y - ((RectangleShape2D)(_startArea.Shape)).Size.Y / 2 && _tempBallSprite.Position.Y <= _startArea.GlobalPosition.Y + ((RectangleShape2D)(_startArea.Shape)).Size.Y / 2)
|
||||
// {
|
||||
// if (Input.IsActionJustReleased("left_click"))
|
||||
// {
|
||||
// _heldBall.Place(_tempBallSprite.Position);
|
||||
// int ballIndex = _ballReturn.IndexOf(_heldBall);
|
||||
|
||||
// AddChild(_heldBall);
|
||||
|
||||
// _ballReturn.Remove(_heldBall);
|
||||
// _tempBallSprite.Texture = null;
|
||||
// if (_ballReturn.Count > 0)
|
||||
// {
|
||||
// _heldBall = _ballReturn[ballIndex - (ballIndex > _ballReturn.Count ? 1 : 0)];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _heldBall = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// for (int i = 0; i < _balls.Count; i++)
|
||||
// {
|
||||
// if (_balls[i]._potted)
|
||||
// {
|
||||
// _balls[i]._potted = false;
|
||||
// _balls[i].Sleeping = true;
|
||||
// _ballReturn.Add(_balls[i]);
|
||||
// RemoveChild(_balls[i]);
|
||||
|
||||
// }
|
||||
// }
|
||||
// if (_balls.Any(b => b._hovered))
|
||||
// {
|
||||
// _hoveredBall = _balls.Single(b => b._hovered);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _hoveredBall = null;
|
||||
// }
|
||||
|
||||
|
||||
// if ((_selectedBall == null || _selectedBall != _hoveredBall) && (_hoveredBall?._available ?? false))
|
||||
// {
|
||||
// if (Input.IsActionJustReleased("left_click"))
|
||||
// {
|
||||
// _selectedBall = _hoveredBall;
|
||||
// _selectedBall._selected = true;
|
||||
// _cue.Don(_selectedBall);
|
||||
// }
|
||||
// }
|
||||
// else if (Input.IsActionJustReleased("right_click"))
|
||||
// {
|
||||
// _selectedBall._selected = false;
|
||||
// _selectedBall = null;
|
||||
// _cue.Doff();
|
||||
// }
|
||||
// else if (_hoveredBall == null)
|
||||
// {
|
||||
// if (Input.IsActionJustReleased("left_click") && _selectedBall != null && _cue._power == 0)
|
||||
// {
|
||||
// _selectedBall._selected = false;
|
||||
// _selectedBall = null;
|
||||
// _cue.Doff();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Panel ballReturn = _panel.GetNode<Panel>("BallReturn");
|
||||
GD.Print(ballReturn.Position);
|
||||
GD.Print(ballReturn.GlobalPosition);
|
||||
|
||||
for (int i = 0; i < _balls.Count; i++)
|
||||
{
|
||||
_balls[i].GetNode<CollisionShape2D>("Bounds").Disabled = true;
|
||||
_balls[i].Position = new Vector2(ballReturn.Size.X/2, 50 * (i + 1));
|
||||
|
||||
_panel.GetNode<Panel>("BallReturn").AddChild(_balls[i]);
|
||||
GD.Print(_balls[i].Position);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnCueShoot(Vector2 IMPULSE)
|
||||
{
|
||||
if (_selectedBall != null && _selectedBall._placed)
|
||||
{
|
||||
_selectedBall.ApplyCentralImpulse(IMPULSE);
|
||||
_selectedBall._selected = false;
|
||||
_selectedBall = null;
|
||||
_cue.Doff();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ActorPanel : Panel
|
||||
{
|
||||
public bool _hovered = false;
|
||||
public Actor _actor;
|
||||
public static ActorPanel _Create(Actor ACTOR)
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/actor_panel.tscn");
|
||||
ActorPanel newActorPanel = scene.Instantiate<ActorPanel>();
|
||||
|
||||
newActorPanel._actor = ACTOR;
|
||||
newActorPanel.SetSprite(newActorPanel._actor.GetNode<Sprite2D>("Sprite").Texture);
|
||||
newActorPanel.SetMax(newActorPanel._actor._healthMax);
|
||||
newActorPanel.SetValue(newActorPanel._actor._health);
|
||||
newActorPanel.SetPosition(new Vector2(50, 50));
|
||||
|
||||
return newActorPanel;
|
||||
}
|
||||
|
||||
public void SetPosition(Vector2 POSITION)
|
||||
{
|
||||
Position = POSITION;
|
||||
}
|
||||
public void SetSprite(Texture2D TEXTURE)
|
||||
{
|
||||
GetNode<Sprite2D>("Image").Texture = TEXTURE;
|
||||
}
|
||||
public void SetValue(int VALUE)
|
||||
{
|
||||
GetNode<Control>("Health").GetNode<RichTextLabel>("Value").Text = VALUE.ToString();
|
||||
GetNode<Control>("Health").GetNode<ProgressBar>("Bar").Value = VALUE;
|
||||
}
|
||||
public void SetMax(int MAX)
|
||||
{
|
||||
GetNode<Control>("Health").GetNode<RichTextLabel>("Max").Text = MAX.ToString();
|
||||
GetNode<Control>("Health").GetNode<ProgressBar>("Bar").MaxValue = MAX;
|
||||
}
|
||||
|
||||
private void OnMouseEntered()
|
||||
{
|
||||
_hovered = true;
|
||||
}
|
||||
|
||||
private void OnMouseExited()
|
||||
{
|
||||
_hovered = false;
|
||||
}
|
||||
}
|
||||
145
Gameplay/Ball.cs
145
Gameplay/Ball.cs
@@ -1,13 +1,15 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
public partial class Ball : RigidBody2D
|
||||
{
|
||||
public bool _placed = false, _potted = false, _available = false, _hovered = false, _selected = false, _aimed = false, _moving = false, _isCue = false;
|
||||
public int _defense, _defenseMax;
|
||||
[Signal]
|
||||
public delegate void OnHitEventHandler();
|
||||
public bool _active = false, _placed = false, _potted = false, _available = false, _hovered = false, _selected = false, _aimed = false, _launched = false, _moving = false, _isCue = false;
|
||||
public float _moveThreshold = 5.0f;
|
||||
|
||||
public Vector2 _newPosition = new Vector2(-1, -1);
|
||||
|
||||
|
||||
public static Ball _Create()
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/ball.tscn");
|
||||
@@ -15,7 +17,14 @@ public partial class Ball : RigidBody2D
|
||||
|
||||
return newBall;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override void _Process(double DELTA_)
|
||||
{
|
||||
if (LinearVelocity.Length() > 0 && LinearVelocity.Length() < _moveThreshold)
|
||||
@@ -24,6 +33,10 @@ public partial class Ball : RigidBody2D
|
||||
if (_moving)
|
||||
{
|
||||
_moving = false;
|
||||
if (_launched)
|
||||
{
|
||||
_launched = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (LinearVelocity.Length() >= _moveThreshold)
|
||||
@@ -33,7 +46,7 @@ public partial class Ball : RigidBody2D
|
||||
_moving = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Globals.Instance._anyMovement)
|
||||
{
|
||||
if (_available)
|
||||
@@ -47,23 +60,125 @@ public partial class Ball : RigidBody2D
|
||||
{
|
||||
_available = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Place(Vector2 POSITION)
|
||||
|
||||
public void Pot()
|
||||
{
|
||||
_placed = true;
|
||||
Position = POSITION;
|
||||
_placed = false;
|
||||
_potted = true;
|
||||
Sleeping = true;
|
||||
_moving = false;
|
||||
}
|
||||
|
||||
|
||||
public void SetSprite(string PATH)
|
||||
{
|
||||
GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>(PATH);
|
||||
}
|
||||
|
||||
private void OnBodyEntered(Node2D TARGET)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnMouseEntered()
|
||||
{
|
||||
_hovered = true;
|
||||
if (_active)
|
||||
{
|
||||
_hovered = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnMouseExited()
|
||||
{
|
||||
_hovered = false;
|
||||
if (_active)
|
||||
{
|
||||
_hovered = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Processes
|
||||
public virtual void ProcessOnAdd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnBattleStart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnBattleEnd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnCollision()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnCreation()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnCritical()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnDeath()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnDefend()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnExpiration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnLaunch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnMovement()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnRemove()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnSell()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnStop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnTurnEnd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnTurnStart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ public partial class Battle : Node
|
||||
|
||||
public bool _current;
|
||||
public Vector2 _startPosition = new Vector2(890, 340);
|
||||
public Player _player;
|
||||
public Player _computer;
|
||||
public Player _turn;
|
||||
public Manager _player;
|
||||
public Manager _computer;
|
||||
public Manager _turn;
|
||||
public List<Sprite2D> _potted = new();
|
||||
public List<Ball> _balls = new();
|
||||
public Table _table;
|
||||
@@ -20,9 +20,9 @@ public partial class Battle : Node
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/battle.tscn");
|
||||
Battle newBattle = scene.Instantiate<Battle>();
|
||||
|
||||
Player newPlayer = Player._Create();
|
||||
newBattle._player = newPlayer;
|
||||
newBattle.AddChild(newPlayer);
|
||||
Manager newManager = Manager._Create();
|
||||
newBattle._player = newManager;
|
||||
newBattle.AddChild(newManager);
|
||||
|
||||
Table newTable = Table._Create();
|
||||
newTable.Position = Globals.Instance._screenCenter;
|
||||
@@ -34,7 +34,7 @@ public partial class Battle : Node
|
||||
.ToList<Area2D>();
|
||||
for (int i = 0; i < pockets.Count; i++)
|
||||
{
|
||||
pockets[i].BodyEntered += newBattle.PottedBall;
|
||||
pockets[i].BodyEntered += newBattle.PotBall;
|
||||
}
|
||||
newBattle.AddChild(newTable);
|
||||
|
||||
@@ -42,7 +42,6 @@ public partial class Battle : Node
|
||||
}
|
||||
public override void _Ready()
|
||||
{
|
||||
_balls = GetTree().GetNodesInGroup("balls").Select(b => (Ball)b).ToList<Ball>();
|
||||
Start();
|
||||
}
|
||||
|
||||
@@ -62,8 +61,13 @@ public partial class Battle : Node
|
||||
for (int j = 0; j <= columns; j++)
|
||||
{
|
||||
Vector2 position = new Vector2(table.GlobalPosition.X - (i * (diameter / 2)) + (j * (diameter)), table.GlobalPosition.Y - table.Texture.GetSize().Y / 4 - (i * diameter));
|
||||
SupportBall ball = SupportBall._Create(count);
|
||||
ball.Place(position);
|
||||
Ball ball = Ball._Create();
|
||||
ball.Position = position;
|
||||
ball._placed = true;
|
||||
ball._potted = false;
|
||||
ball.GetNode<CollisionShape2D>("Bounds").Disabled = false;
|
||||
ball.SetSprite("res://art/ball_"+count+".png");
|
||||
_balls.Add(ball);
|
||||
AddChild(ball);
|
||||
|
||||
count += 1;
|
||||
@@ -75,7 +79,8 @@ public partial class Battle : Node
|
||||
|
||||
public void CheckMovement()
|
||||
{
|
||||
bool movementCheck = _balls.Any(b => b._moving && b._placed);
|
||||
bool movementCheck = _balls.Any(b => b._moving);
|
||||
|
||||
if (movementCheck)
|
||||
{
|
||||
if (!Globals.Instance._anyMovement)
|
||||
@@ -94,29 +99,23 @@ public partial class Battle : Node
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PottedBall(Node2D BODY)
|
||||
|
||||
public void PotBall(Node2D BODY)
|
||||
{
|
||||
if (BODY.GetType() != typeof(Ball))
|
||||
if (BODY is Ball)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (((Ball)BODY)._isCue)
|
||||
{
|
||||
((Ball)BODY)._potted = true;
|
||||
((Ball)BODY)._placed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Panel pottedPanel = GetNode<Panel>("PottedPanel");
|
||||
// Sprite2D ballSprite = new Sprite2D();
|
||||
// AddChild(ballSprite);
|
||||
// ballSprite.Texture = BODY.GetNode<Sprite2D>("Image").Texture;
|
||||
// _potted.Add(ballSprite);
|
||||
// ballSprite.Position = new Vector2(pottedPanel.Position.X + pottedPanel.Size.X / 2, pottedPanel.Position.Y + (50 * _potted.Count));
|
||||
((Ball)BODY)._placed = false;
|
||||
((Ball)BODY)._potted = true;
|
||||
BODY.QueueFree();
|
||||
Ball ball = (Ball)BODY;
|
||||
if (ball.GetParentOrNull<Manager>() == _player)
|
||||
{
|
||||
_player.PotWorker(ball.GetParent<Worker>());
|
||||
}
|
||||
else
|
||||
{
|
||||
ball.Pot();
|
||||
_balls.Remove(ball);
|
||||
RemoveChild(ball);
|
||||
ball.QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +77,9 @@ public partial class Cue : Sprite2D
|
||||
//_progressBar.Hide();
|
||||
}
|
||||
|
||||
public void Don(Ball CUEBALL)
|
||||
public void Don(Vector2 POSITION)
|
||||
{
|
||||
Position = CUEBALL.Position;
|
||||
Position = POSITION;
|
||||
_donned = true;
|
||||
SetProcess(true);
|
||||
Show();
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
public partial class CueBall : Ball
|
||||
{
|
||||
|
||||
new public static CueBall _Create()
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/cue_ball.tscn");
|
||||
CueBall newBall = scene.Instantiate<CueBall>();
|
||||
|
||||
newBall._isCue = true;
|
||||
newBall.GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>("res://art/cue_ball.png");
|
||||
return newBall;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://cccd8cs6b5xmd
|
||||
@@ -1,11 +1,12 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Globals : Node
|
||||
{
|
||||
public static Globals Instance;
|
||||
|
||||
public bool _anyMovement;
|
||||
public bool _anyMovement = false;
|
||||
public Vector2 _screenSize;
|
||||
public Vector2 _screenCenter;
|
||||
public Battle _currentBattle;
|
||||
|
||||
227
Gameplay/Manager.cs
Normal file
227
Gameplay/Manager.cs
Normal file
@@ -0,0 +1,227 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Manager : Node
|
||||
{
|
||||
public bool _dead, _ready;
|
||||
public int _health, _healthMax;
|
||||
public Cue _cue;
|
||||
public Worker _lead;
|
||||
public List<Worker> _team = new();
|
||||
public Worker _hoveredWorker = null;
|
||||
public Worker _selectedWorker = null;
|
||||
public Worker _heldWorker = null;
|
||||
|
||||
public static Manager _Create()
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/manager.tscn");
|
||||
Manager newManager = scene.Instantiate<Manager>();
|
||||
|
||||
Worker newWorker = Worker._Create();
|
||||
newWorker.GetNode<Ball>("Ball").SetSprite("res://art/cue_ball.png");
|
||||
newWorker.GetNode<TempBall>("TempBall").SetSprite("res://art/cue_ball.png");
|
||||
// newWorker.ChangeBallPosition(new Vector2(100, 100));
|
||||
newManager._lead = newWorker;
|
||||
newManager._team.Add(newWorker);
|
||||
newManager.AddChild(newWorker);
|
||||
|
||||
newManager._health = 10;
|
||||
newManager._healthMax = newManager._health;
|
||||
|
||||
newManager.GetNode<ManagerPanel>("Panel").SetSprite("res://art/ness.png");
|
||||
newManager.GetNode<ManagerPanel>("Panel").SetMax(newManager._healthMax);
|
||||
newManager.GetNode<ManagerPanel>("Panel").SetValue(newManager._health);
|
||||
return newManager;
|
||||
}
|
||||
|
||||
public override void _Process(double DELTA_)
|
||||
{
|
||||
if (_team.Any(w => w._hovered))
|
||||
{
|
||||
_hoveredWorker = _team.Single(w => w._hovered);
|
||||
}
|
||||
else
|
||||
{
|
||||
_hoveredWorker = null;
|
||||
}
|
||||
|
||||
if (_ready)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_heldWorker == null)
|
||||
{
|
||||
if (Input.IsActionJustReleased("left_click"))
|
||||
{
|
||||
if (!_hoveredWorker._placed)
|
||||
{
|
||||
_heldWorker = _hoveredWorker;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 mousePosition = GetViewport().GetMousePosition();
|
||||
_heldWorker._tempBall.Position = mousePosition;
|
||||
if (Input.IsActionJustReleased("left_click"))
|
||||
{
|
||||
_heldWorker.PlaceBall(mousePosition);
|
||||
_heldWorker = null;
|
||||
if (_team.Where(w => w._placed).ToList().Count >= _team.Count)
|
||||
{
|
||||
_ready = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (!Globals.Instance._anyMovement)
|
||||
// {
|
||||
// if (_team.Any(w => w._hovered))
|
||||
// {
|
||||
// _hoveredWorker = _team.Single(w => w._hovered);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _hoveredWorker = null;
|
||||
// }
|
||||
|
||||
// if (!_ready)
|
||||
// {
|
||||
// if (_heldWorker == null)
|
||||
// {
|
||||
// if (Input.IsActionJustReleased("left_click"))
|
||||
// {
|
||||
// if (!_hoveredWorker._placed)
|
||||
// {
|
||||
// _heldWorker = _hoveredWorker;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Vector2 mousePosition = GetViewport().GetMousePosition();
|
||||
// _heldWorker.Position = mousePosition;
|
||||
// if (Input.IsActionJustReleased("left_click"))
|
||||
// {
|
||||
// PlaceWorker(_heldWorker, mousePosition);
|
||||
// _heldWorker = null;
|
||||
// if (_team.Where(w => w._placed).ToList().Count >= _team.Count)
|
||||
// {
|
||||
// _ready = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if ((_selectedWorker == null || _selectedWorker != _hoveredWorker) && (_hoveredWorker?._available ?? false))
|
||||
// {
|
||||
// if (Input.IsActionJustReleased("left_click"))
|
||||
// {
|
||||
// _selectedWorker = _hoveredWorker;
|
||||
// _selectedWorker._selected = true;
|
||||
// _cue.Don(_selectedWorker.GetNode<Ball>("Ball").Position);
|
||||
// }
|
||||
// }
|
||||
// else if (Input.IsActionJustReleased("right_click"))
|
||||
// {
|
||||
// _selectedWorker._selected = false;
|
||||
// _selectedWorker = null;
|
||||
// _cue.Doff();
|
||||
// }
|
||||
// else if (_hoveredWorker == null)
|
||||
// {
|
||||
// if (Input.IsActionJustReleased("left_click") && _selectedWorker != null && _cue._power == 0)
|
||||
// {
|
||||
// _selectedWorker._selected = false;
|
||||
// _selectedWorker = null;
|
||||
// _cue.Doff();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public void ChangeHealth(int CHANGE)
|
||||
{
|
||||
_health += CHANGE;
|
||||
GD.Print("Health: " + _health);
|
||||
_health = Math.Min(_health, _healthMax);
|
||||
|
||||
if (_health < 0)
|
||||
{
|
||||
_dead = true;
|
||||
_health = 0;
|
||||
}
|
||||
GetNode<ManagerPanel>("Panel").SetValue(_health);
|
||||
}
|
||||
|
||||
// public void ReturnWorker(Worker WORKER)
|
||||
// {
|
||||
// Panel ballReturn = GetNode<ManagerPanel>("Panel").GetNode<Panel>("BallReturn");
|
||||
// int ballsInReturn = _team.Where(b => !b._placed).ToList().Count;
|
||||
|
||||
// WORKER.GetNode<Ball>("Ball").Position = ;
|
||||
// WORKER.GetNode<Ball>("Ball").GetNode<CollisionShape2D>("Bounds").Disabled = true;
|
||||
|
||||
// AddChild(WORKER);
|
||||
// }
|
||||
|
||||
public void PlaceWorker(Worker WORKER, Vector2 POSITION)
|
||||
{
|
||||
WORKER._placed = true;
|
||||
WORKER._potted = false;
|
||||
WORKER.ChangeBallPosition(POSITION);
|
||||
WORKER.GetNode<CollisionShape2D>("Bounds").Disabled = false;
|
||||
}
|
||||
|
||||
public void PotWorker(Worker WORKER)
|
||||
{
|
||||
Panel ballReturn = GetNode<ManagerPanel>("Panel").GetNode<Panel>("BallReturn");
|
||||
WORKER.PotBall();
|
||||
WORKER.ChangeBallPosition(new Vector2(ballReturn.GlobalPosition.X + ballReturn.Size.X / 2, ballReturn.GlobalPosition.Y + 50));
|
||||
_ready = false;
|
||||
}
|
||||
|
||||
public void SetSprite(string PATH)
|
||||
{
|
||||
GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>(PATH);
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Panel ballReturn = GetNode<ManagerPanel>("Panel").GetNode<Panel>("BallReturn");
|
||||
|
||||
for (int i = 0; i < _team.Count; i++)
|
||||
{
|
||||
_team[i]._ball.GetNode<CollisionShape2D>("Bounds").Disabled = true;
|
||||
if (_team[i].GetNodeOrNull<Ball>("Ball") != null)
|
||||
{
|
||||
_team[i].RemoveChild(_team[i]._ball);
|
||||
}
|
||||
_team[i].AddChild(_team[i]._tempBall);
|
||||
_team[i]._tempBall.Position = new Vector2(ballReturn.GlobalPosition.X + ballReturn.Size.X / 2, ballReturn.GlobalPosition.Y + 50 * (i + 1));
|
||||
// _team[i].Position = new Vector2(ballReturn.GlobalPosition.X + ballReturn.Size.X / 2, ballReturn.GlobalPosition.Y + 50 * (i + 1));
|
||||
|
||||
// AddChild(_team[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCueShoot(Vector2 IMPULSE)
|
||||
{
|
||||
if (_selectedWorker != null && _selectedWorker._placed)
|
||||
{
|
||||
_selectedWorker.GetNode<Ball>("Ball").ApplyCentralImpulse(IMPULSE);
|
||||
_selectedWorker._selected = false;
|
||||
_selectedWorker._launched = true;
|
||||
_selectedWorker = null;
|
||||
_cue.Doff();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Gameplay/ManagerPanel.cs
Normal file
36
Gameplay/ManagerPanel.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ManagerPanel : Panel
|
||||
{
|
||||
public bool _hovered = false;
|
||||
|
||||
public void SetPosition(Vector2 POSITION)
|
||||
{
|
||||
Position = POSITION;
|
||||
}
|
||||
public void SetSprite(string PATH)
|
||||
{
|
||||
GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>(PATH);
|
||||
}
|
||||
public void SetValue(int VALUE)
|
||||
{
|
||||
GetNode<Control>("Health").GetNode<RichTextLabel>("Value").Text = VALUE.ToString();
|
||||
GetNode<Control>("Health").GetNode<ProgressBar>("Bar").Value = VALUE;
|
||||
}
|
||||
public void SetMax(int MAX)
|
||||
{
|
||||
GetNode<Control>("Health").GetNode<RichTextLabel>("Max").Text = MAX.ToString();
|
||||
GetNode<Control>("Health").GetNode<ProgressBar>("Bar").MaxValue = MAX;
|
||||
}
|
||||
|
||||
private void OnMouseEntered()
|
||||
{
|
||||
_hovered = true;
|
||||
}
|
||||
|
||||
private void OnMouseExited()
|
||||
{
|
||||
_hovered = false;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Player : Node
|
||||
{
|
||||
public bool _available, _selected;
|
||||
public Actor _teamLead;
|
||||
|
||||
public static Player _Create()
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/player.tscn");
|
||||
Player newPlayer = scene.Instantiate<Player>();
|
||||
|
||||
Actor newActor = Actor._Create();
|
||||
newPlayer._teamLead = newActor;
|
||||
newPlayer.AddChild(newActor);
|
||||
|
||||
return newPlayer;
|
||||
}
|
||||
|
||||
public override void _Process(double DELTA_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_teamLead.Start();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,6 @@ public partial class PowerBar : ProgressBar
|
||||
|
||||
public override void _Process(double DELTA_)
|
||||
{
|
||||
Value = GetParent().GetNode<Actor>("Actor").GetNode<Cue>("Cue")._power / GetParent().GetNode<Actor>("Actor").GetNode<Cue>("Cue")._maxPower * 100;
|
||||
// Value = GetParent().GetNode<Manager>("Manager").GetNode<Cue>("Cue")._power / GetParent().GetNode<Manager>("Manager").GetNode<Cue>("Cue")._maxPower * 100;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
public partial class SupportBall : Ball
|
||||
{
|
||||
|
||||
public static SupportBall _Create(int NUMBER)
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/support_ball.tscn");
|
||||
SupportBall newBall = scene.Instantiate<SupportBall>();
|
||||
|
||||
newBall.GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>("res://art/ball_" + NUMBER + ".png");
|
||||
return newBall;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://cwv3ic5qviw37
|
||||
28
Gameplay/TempBall.cs
Normal file
28
Gameplay/TempBall.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class TempBall : Area2D
|
||||
{
|
||||
public bool _active = false, _hovered = false, _held = false;
|
||||
|
||||
public void SetSprite(string PATH)
|
||||
{
|
||||
GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>(PATH);
|
||||
}
|
||||
|
||||
private void OnMouseEntered()
|
||||
{
|
||||
if (_active)
|
||||
{
|
||||
_hovered = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouseExited()
|
||||
{
|
||||
if (_active)
|
||||
{
|
||||
_hovered = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Gameplay/TempBall.cs.uid
Normal file
1
Gameplay/TempBall.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c2rt5f831l1l1
|
||||
86
Gameplay/Worker.cs
Normal file
86
Gameplay/Worker.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Worker : Node2D
|
||||
{
|
||||
[Signal]
|
||||
public delegate void DamageOverflowEventHandler(int OVERFLOW);
|
||||
public bool _dead = false, _available = false, _hovered = false, _selected = false, _launched = false, _placed = false, _potted = false, _isLead = false;
|
||||
public int _defense = 5, _defenseMax = 5;
|
||||
public CollisionShape2D _startArea;
|
||||
public TempBall _tempBall;
|
||||
public Ball _ball;
|
||||
|
||||
public static Worker _Create()
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/worker.tscn");
|
||||
Worker newWorker = scene.Instantiate<Worker>();
|
||||
return newWorker;
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_ball = GetNode<Ball>("Ball");
|
||||
_tempBall = GetNode<TempBall>("TempBall");
|
||||
|
||||
RemoveChild(_ball);
|
||||
RemoveChild(_tempBall);
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
_hovered = _ball._hovered || _tempBall._hovered;
|
||||
}
|
||||
|
||||
public virtual void ChangeBallPosition(Vector2 NEWPOSITION)
|
||||
{
|
||||
RemoveChild(_ball);
|
||||
_ball.Position = NEWPOSITION;
|
||||
AddChild(_ball);
|
||||
}
|
||||
|
||||
public virtual void ChangeDefense(int CHANGE)
|
||||
{
|
||||
_defense += CHANGE;
|
||||
_defense = Math.Min(_defense, _defenseMax);
|
||||
if (_defense < 0)
|
||||
{
|
||||
EmitSignal(SignalName.DamageOverflow, _defense);
|
||||
if (!_isLead)
|
||||
{
|
||||
PotBall();
|
||||
}
|
||||
_defense = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSprite(string PATH)
|
||||
{
|
||||
GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>(PATH);
|
||||
}
|
||||
|
||||
public void PlaceBall(Vector2 POSITION)
|
||||
{
|
||||
_ball.Position = POSITION;
|
||||
AddChild(_ball);
|
||||
}
|
||||
|
||||
public void PotBall()
|
||||
{
|
||||
_ball.Pot();
|
||||
RemoveChild(_ball);
|
||||
}
|
||||
|
||||
public void OnBallHit()
|
||||
{
|
||||
// if (!_launched)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// Ball target = (Ball)TARGET;
|
||||
// target.ChangeDefense(-1);
|
||||
// ChangeDefense(-6);
|
||||
// GD.Print("Defense: " + _defense);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://72tgm5p8d32r"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b4mr2vn8mw6r4" path="res://Gameplay/Actor.cs" id="1_hr3hk"]
|
||||
|
||||
[node name="Actor" type="Node2D"]
|
||||
script = ExtResource("1_hr3hk")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://c8n4lue2bn25n"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://c8n4lue2bn25n"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dgdxx8tceiljg" path="res://Gameplay/Ball.cs" id="1_7ritg"]
|
||||
[ext_resource type="Shader" uid="uid://b6vvt5o0008ob" path="res://shaders/globe.gdshader" id="2_6v01e"]
|
||||
@@ -16,6 +16,9 @@ shader_parameter/globe_magnitude = 0.0
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_803qd"]
|
||||
radius = 18.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_wmcg2"]
|
||||
radius = 18.0
|
||||
|
||||
[node name="Ball" type="RigidBody2D" groups=["balls"]]
|
||||
z_index = 1
|
||||
input_pickable = true
|
||||
@@ -33,6 +36,14 @@ material = SubResource("ShaderMaterial_yj7wd")
|
||||
position = Vector2(0, -7.10543e-15)
|
||||
shape = SubResource("CircleShape2D_803qd")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
disable_mode = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource("CircleShape2D_wmcg2")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="OnBodyEntered"]
|
||||
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]
|
||||
[connection signal="mouse_entered" from="Area2D" to="." method="OnMouseEntered"]
|
||||
[connection signal="mouse_exited" from="Area2D" to="." method="OnMouseExited"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://qlhqpubnb7t2"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://3vjkqdwxwtot"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://b6vvt5o0008ob" path="res://shaders/globe.gdshader" id="2_oil24"]
|
||||
[ext_resource type="Script" uid="uid://cccd8cs6b5xmd" path="res://Gameplay/CueBall.cs" id="2_x5gxx"]
|
||||
[ext_resource type="Script" path="res://Gameplay/CueBall.cs" id="2_x5gxx"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_yj7wd"]
|
||||
bounce = 5.0
|
||||
@@ -16,6 +16,9 @@ shader_parameter/globe_magnitude = 0.0
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_803qd"]
|
||||
radius = 18.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_x5gxx"]
|
||||
radius = 18.0
|
||||
|
||||
[node name="CueBall" type="RigidBody2D" groups=["balls"]]
|
||||
z_index = 1
|
||||
input_pickable = true
|
||||
@@ -33,6 +36,14 @@ material = SubResource("ShaderMaterial_yj7wd")
|
||||
position = Vector2(0, -7.10543e-15)
|
||||
shape = SubResource("CircleShape2D_803qd")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
disable_mode = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource("CircleShape2D_x5gxx")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="OnBodyEntered"]
|
||||
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]
|
||||
[connection signal="mouse_entered" from="Area2D" to="." method="OnMouseEntered"]
|
||||
[connection signal="mouse_exited" from="Area2D" to="." method="OnMouseExited"]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dw3f81s6epejq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://brjvplo1avnoq" path="res://Gameplay/Globals.cs" id="1_f6yec"]
|
||||
[ext_resource type="Script" uid="uid://brjvplo1avnoq" path="res://Gameplay/Globals.cs" id="1_pbrrl"]
|
||||
|
||||
[node name="Globals" type="Node"]
|
||||
script = ExtResource("1_f6yec")
|
||||
script = ExtResource("1_pbrrl")
|
||||
37
Gameplay/manager.tscn
Normal file
37
Gameplay/manager.tscn
Normal file
@@ -0,0 +1,37 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://cdaxqopr35lll"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b66ysicyh0m1s" path="res://Gameplay/Manager.cs" id="1_ivgep"]
|
||||
[ext_resource type="Script" uid="uid://dbfpn1p62siat" path="res://Gameplay/PowerBar.cs" id="2_muxv4"]
|
||||
[ext_resource type="PackedScene" uid="uid://8kv00jc35dma" path="res://Gameplay/manager_panel.tscn" id="3_muxv4"]
|
||||
[ext_resource type="PackedScene" uid="uid://dm4xk16ce0j" path="res://Gameplay/cue.tscn" id="4_2skxn"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_i3pqv"]
|
||||
bg_color = Color(1, 1, 1, 0.458824)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hqtel"]
|
||||
bg_color = Color(0.92549, 0.0901961, 0.0627451, 1)
|
||||
|
||||
[node name="Manager" type="Node"]
|
||||
script = ExtResource("1_ivgep")
|
||||
|
||||
[node name="PowerBar" type="ProgressBar" parent="."]
|
||||
visible = false
|
||||
z_index = 1
|
||||
offset_right = 100.0
|
||||
offset_bottom = 30.0
|
||||
theme_override_styles/background = SubResource("StyleBoxFlat_i3pqv")
|
||||
theme_override_styles/fill = SubResource("StyleBoxFlat_hqtel")
|
||||
show_percentage = false
|
||||
script = ExtResource("2_muxv4")
|
||||
|
||||
[node name="Panel" parent="." instance=ExtResource("3_muxv4")]
|
||||
offset_left = 101.0
|
||||
offset_top = 150.0
|
||||
offset_right = 551.0
|
||||
offset_bottom = 280.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
|
||||
[node name="Cue" parent="." instance=ExtResource("4_2skxn")]
|
||||
|
||||
[connection signal="Shoot" from="Cue" to="." method="OnCueShoot"]
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://8kv00jc35dma"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c4ekvurl6q7jn" path="res://Gameplay/ActorPanel.cs" id="1_dg1wx"]
|
||||
[ext_resource type="Script" uid="uid://c4ekvurl6q7jn" path="res://Gameplay/ManagerPanel.cs" id="1_8n1hc"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_e1ofl"]
|
||||
bg_color = Color(1, 1, 1, 1)
|
||||
@@ -17,23 +17,24 @@ bg_color = Color(0.501407, 0.501406, 0.501406, 1)
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_058dj"]
|
||||
bg_color = Color(1, 1, 1, 1)
|
||||
|
||||
[node name="ActorPanel" type="Panel"]
|
||||
[node name="ManagerPanel" type="Panel"]
|
||||
offset_right = 450.0
|
||||
offset_bottom = 130.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_e1ofl")
|
||||
script = ExtResource("1_dg1wx")
|
||||
script = ExtResource("1_8n1hc")
|
||||
|
||||
[node name="Name" type="RichTextLabel" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 20.0
|
||||
offset_left = 1.0
|
||||
offset_top = 8.0
|
||||
offset_right = 170.0
|
||||
offset_right = 197.0
|
||||
offset_bottom = 48.0
|
||||
theme_override_colors/default_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/normal_font_size = 24
|
||||
text = "Actor Name"
|
||||
text = "Manager Name"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
@@ -42,10 +43,11 @@ position = Vector2(100, 75)
|
||||
|
||||
[node name="Health" type="Control" parent="."]
|
||||
anchors_preset = 0
|
||||
offset_left = 203.0
|
||||
offset_left = 221.0
|
||||
offset_top = 6.0
|
||||
offset_right = 429.0
|
||||
offset_right = 447.0
|
||||
offset_bottom = 51.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Label" type="RichTextLabel" parent="Health"]
|
||||
layout_mode = 2
|
||||
@@ -60,7 +62,7 @@ theme_override_font_sizes/normal_font_size = 24
|
||||
text = "Health"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Max" type="RichTextLabel" parent="Health"]
|
||||
[node name="Value" type="RichTextLabel" parent="Health"]
|
||||
layout_mode = 2
|
||||
offset_left = 83.0
|
||||
offset_top = 2.0
|
||||
@@ -89,7 +91,7 @@ text = "/
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Value" type="RichTextLabel" parent="Health"]
|
||||
[node name="Max" type="RichTextLabel" parent="Health"]
|
||||
layout_mode = 2
|
||||
offset_left = 156.0
|
||||
offset_top = 2.0
|
||||
@@ -121,6 +123,7 @@ layout_mode = 0
|
||||
offset_left = 475.0
|
||||
offset_right = 550.0
|
||||
offset_bottom = 800.0
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_j2own")
|
||||
|
||||
[node name="Desk" type="Panel" parent="."]
|
||||
@@ -128,6 +131,7 @@ layout_mode = 0
|
||||
offset_top = 150.0
|
||||
offset_right = 450.0
|
||||
offset_bottom = 800.0
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_j2own")
|
||||
|
||||
[node name="DeskOrnament1" type="Panel" parent="Desk"]
|
||||
@@ -1,23 +0,0 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cdaxqopr35lll"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b66ysicyh0m1s" path="res://Gameplay/Player.cs" id="1_4flbx"]
|
||||
[ext_resource type="Script" uid="uid://dbfpn1p62siat" path="res://Gameplay/PowerBar.cs" id="2_onrkg"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_i3pqv"]
|
||||
bg_color = Color(1, 1, 1, 0.458824)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hqtel"]
|
||||
bg_color = Color(0.92549, 0.0901961, 0.0627451, 1)
|
||||
|
||||
[node name="Player" type="Node"]
|
||||
script = ExtResource("1_4flbx")
|
||||
|
||||
[node name="PowerBar" type="ProgressBar" parent="."]
|
||||
visible = false
|
||||
z_index = 1
|
||||
offset_right = 100.0
|
||||
offset_bottom = 30.0
|
||||
theme_override_styles/background = SubResource("StyleBoxFlat_i3pqv")
|
||||
theme_override_styles/fill = SubResource("StyleBoxFlat_hqtel")
|
||||
show_percentage = false
|
||||
script = ExtResource("2_onrkg")
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dylhg83cnxckv"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://yr7ufhp84bfa"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cwv3ic5qviw37" path="res://Gameplay/SupportBall.cs" id="2_4wdnc"]
|
||||
[ext_resource type="Script" path="res://Gameplay/SupportBall.cs" id="2_4wdnc"]
|
||||
[ext_resource type="Shader" uid="uid://b6vvt5o0008ob" path="res://shaders/globe.gdshader" id="2_jnwku"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_yj7wd"]
|
||||
@@ -16,6 +16,9 @@ shader_parameter/globe_magnitude = 0.0
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_803qd"]
|
||||
radius = 18.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_4wdnc"]
|
||||
radius = 18.0
|
||||
|
||||
[node name="SupportBall" type="RigidBody2D" groups=["balls"]]
|
||||
z_index = 1
|
||||
input_pickable = true
|
||||
@@ -33,6 +36,14 @@ material = SubResource("ShaderMaterial_yj7wd")
|
||||
position = Vector2(0, -7.10543e-15)
|
||||
shape = SubResource("CircleShape2D_803qd")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
disable_mode = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource("CircleShape2D_4wdnc")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="OnBodyEntered"]
|
||||
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]
|
||||
[connection signal="mouse_entered" from="Area2D" to="." method="OnMouseEntered"]
|
||||
[connection signal="mouse_exited" from="Area2D" to="." method="OnMouseExited"]
|
||||
|
||||
17
Gameplay/temp_ball.tscn
Normal file
17
Gameplay/temp_ball.tscn
Normal file
@@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cxvrswwjwxgxj"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c2rt5f831l1l1" path="res://Gameplay/TempBall.cs" id="1_y0oty"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_vjx3o"]
|
||||
radius = 18.0
|
||||
|
||||
[node name="TempBall" type="Area2D"]
|
||||
script = ExtResource("1_y0oty")
|
||||
|
||||
[node name="Image" type="Sprite2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_vjx3o")
|
||||
|
||||
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]
|
||||
17
Gameplay/worker.tscn
Normal file
17
Gameplay/worker.tscn
Normal file
@@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://72tgm5p8d32r"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b4mr2vn8mw6r4" path="res://Gameplay/Worker.cs" id="1_e314i"]
|
||||
[ext_resource type="PackedScene" uid="uid://c8n4lue2bn25n" path="res://Gameplay/ball.tscn" id="2_m3kx1"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxvrswwjwxgxj" path="res://Gameplay/temp_ball.tscn" id="3_4poc8"]
|
||||
|
||||
[node name="Worker" type="Node2D"]
|
||||
script = ExtResource("1_e314i")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
|
||||
[node name="Ball" parent="." instance=ExtResource("2_m3kx1")]
|
||||
|
||||
[node name="TempBall" parent="." instance=ExtResource("3_4poc8")]
|
||||
|
||||
[connection signal="OnHit" from="Ball" to="." method="OnHit"]
|
||||
Reference in New Issue
Block a user