Compare commits

...

7 Commits

56 changed files with 722 additions and 466 deletions

7
Gameplay/Cell.cs Normal file
View File

@@ -0,0 +1,7 @@
using Godot;
using System;
public partial class Cell : Sprite2D
{
public int _row, _column, _size;
}

1
Gameplay/Cell.cs.uid Normal file
View File

@@ -0,0 +1 @@
uid://cmw4772lmwms0

30
Gameplay/Condition.cs Normal file
View File

@@ -0,0 +1,30 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class Condition : Node
{
public bool _canExpire, _expired;
public int _countdown;
public Timer _timer = new();
public Node _target;
public List<Trigger.On> _triggers = new();
public List<Trigger.On> _expirations = new();
public Node2D _owner;
public Condition(Node2D OWNER)
{
_owner = OWNER;
}
public virtual void Fire()
{
}
public virtual void Target(Node TARGET)
{
_target = TARGET;
}
}

View File

@@ -0,0 +1 @@
uid://vj2qucjwah5y

View File

@@ -1,13 +1,78 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class Desk : Sprite2D
public partial class Desk : Node2D
{
public Vector2 _topLeft, _cellDimensions, _gridDimensions;
public Cell _light, _dark;
Node2D _grid;
public override void _Ready()
{
_grid = GetNode<Node2D>("Cells");
_light = GetNode<Cell>("Light");
_dark = GetNode<Cell>("Dark");
}
public override void _Ready()
{
Position = Globals.Instance._screenCenter;
}
public Cell GetCellFromAddress(int ROW, int COLUMN)
{
if (_grid.HasNode("R" + ROW))
{
Node2D row = _grid.GetNode<Node2D>("R" + ROW);
if (row.HasNode("C" + COLUMN))
{
Cell column = row.GetNode<Cell>("C" + COLUMN);
return column;
}
}
return null;
}
public Vector2 GetPositionFromAddress(int ROW, int COLUMN)
{
Cell cell = GetCellFromAddress(ROW, COLUMN);
if (cell != null)
{
return cell.GlobalPosition;
}
return new Vector2(-1, -1);
}
public void Setup(int ROWS, int COLUMNS, int CELLSIZE)
{
_gridDimensions = new Vector2(COLUMNS, ROWS);
_cellDimensions = new Vector2(CELLSIZE, CELLSIZE);
_light.Scale = _cellDimensions / _light.Texture.GetSize();
_dark.Scale = _cellDimensions / _dark.Texture.GetSize();
_topLeft = Globals.Instance._screenCenter - _cellDimensions * _gridDimensions / 2 + _cellDimensions / 2;
Vector2 position;
Node2D row;
Cell column;
for (int i = 0; i < _gridDimensions.Y; i++)
{
if (i <= _grid.GetChildCount())
{
row = new();
row.Name = "R" + (i + 1);
_grid.AddChild(row);
}
for (int j = 0; j < _gridDimensions.X; j++)
{
position = _topLeft + new Vector2(_cellDimensions.X * j, _cellDimensions.Y * i);
column = (Cell)((i + j) % 2 == 0 ? _light : _dark).Duplicate();
column._size = (int)(column.Texture.GetSize().Y * column.Scale.Y);
column.Name = "C" + (j + 1);
column.GlobalPosition = position;
column.Visible = true;
column._row = i + 1;
column._column = j + 1;
row = _grid.GetNode<Node2D>("R" + (i + 1));
row.AddChild(column);
}
}
}
}

View File

@@ -1,35 +0,0 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class Effect : Node
{
public List<Trigger> _trigger = new();
public List<Trigger> _expirations = new();
public Node2D _owner;
public Effect(Node2D OWNER)
{
_owner = OWNER;
}
public virtual void TriggerEffect(Node TARGET = null)
{
}
public enum Trigger
{
Movement,
Collision,
WallCollision,
Death,
Launch,
Stop,
BattleStart,
BattleEnd,
Critical,
Defend,
Time
}
}

View File

@@ -1,30 +0,0 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class BasicAttack : Effect
{
public BasicAttack(Node2D OWNER) : base(OWNER)
{
_trigger.Add(Trigger.Collision);
}
public override void TriggerEffect(Node TARGET = null)
{
if (TARGET is Worker)
{
Worker target = (Worker)TARGET;
if (_owner is Worker)
{
Worker owner = (Worker)_owner;
if (target._manager != owner._manager)
{
int damage = -owner._aptitude / 2;
target.ChangeHealth(damage, owner);
}
}
}
}
}

View File

@@ -1,22 +0,0 @@
using Godot;
using System;
public partial class Caffeinate : Effect
{
public Caffeinate(Node2D OWNER) : base(OWNER)
{
_trigger.Add(Trigger.Collision);
}
public override void TriggerEffect(Node TARGET = null)
{
if (TARGET is Worker)
{
Worker target = (Worker)TARGET;
target._rotationalForce += 10;
Vector2 targetDistanceNormal = (target.Position - _owner.Position).Normalized();
target.ApplyCentralForce(targetDistanceNormal * 10);
target.ChangeHealth(-1, _owner);
}
}
}

View File

@@ -1,20 +0,0 @@
using Godot;
using System;
public partial class Spiky : Effect
{
public Spiky(Node2D OWNER) : base(OWNER)
{
_trigger.Add(Trigger.Collision);
}
public override void TriggerEffect(Node TARGET = null)
{
if (TARGET is Worker)
{
Worker target = (Worker)TARGET;
target._rotationalForce += 10;
target.ChangeHealth(-1, _owner);
}
}
}

View File

@@ -1 +0,0 @@
uid://ciwja82k4ihw6

View File

@@ -1,3 +0,0 @@
[gd_scene format=3 uid="uid://bih70e65g1108"]
[node name="BasicAttack" type="Node"]

View File

@@ -1,6 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://bo2rj0albmkkw"]
[ext_resource type="Script" uid="uid://cbk76ik5o17nx" path="res://Gameplay/Effects/Caffeinate.cs" id="1_2f3ha"]
[node name="Caffeinate" type="Node"]
script = ExtResource("1_2f3ha")

View File

@@ -1,6 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://cchjk4lohg8k3"]
[ext_resource type="Script" uid="uid://ciwja82k4ihw6" path="res://Gameplay/Effects/Spiky.cs" id="1_levtu"]
[node name="Spiky" type="Node"]
script = ExtResource("1_levtu")

View File

@@ -5,6 +5,7 @@ using System.Collections.Generic;
public partial class Globals : Node
{
public static Globals Instance;
public bool _battleRunning = false;
public Viewport _viewport;
public Vector2 _screenSize;
public Vector2 _screenCenter;
@@ -19,6 +20,5 @@ public partial class Globals : Node
_screenSize = _viewport.GetVisibleRect().Size;
_screenCenter = _screenSize / 2;
}
}

View File

@@ -17,12 +17,16 @@ public partial class Main : Node
_currentBattle.Start();
}
public override void _Process(double DELTA_)
{
public override void _Process(double DELTA_)
{
if (Input.IsActionJustReleased("quit_game"))
{
GetTree().Quit();
}
if (Input.IsActionJustPressed("space"))
{
Globals.Instance._battleRunning = !Globals.Instance._battleRunning;
}
}
}

View File

@@ -4,61 +4,101 @@ using System.Collections.Generic;
using System.Linq;
/// TODO alter code to player vs computer to account for differing logic
public partial class Manager : Node
public partial class Manager : Node2D
{
public bool _dead, _ready;
public int _ballsMoving = 0, _health = 10, _healthMax;
public bool _dead, _ready, _moving;
public int _ballsMoving = 0, _health = 10, _healthMax, _speed = 5;
public string _imagePath;
public CollisionShape2D _startArea;
public ManagerPanel _managerPanel = null;
public Sprite2D _image;
public Desk _desk = null;
public Cell _cell;
public List<Cell> _moves = new();
public Manager _opponent;
public List<Worker> _workers = new();
public List<Tchotchke> _tchotckes = new();
public Node _workerNode;
public Worker _hoveredWorker, _selectedWorker, _heldWorker;
// public List<Tchotchke> _tchotckes = new();
public override void _Ready()
{
_workerNode = GetNode("Workers");
_healthMax = _health;
SetSprite("res://art/ness.png");
_managerPanel = GetNode<ManagerPanel>("Panel");
// _managerPanel = GetNode<ManagerPanel>("Panel");
_desk = GetNode<Desk>("Desk");
_desk.Setup(15, 20, 50);
_cell = _desk.GetCellFromAddress(1, 1);
// _movements.Insert(0, _deskPosition);
_image = GetNode<Sprite2D>("Image");
_image.GlobalPosition = _cell.GlobalPosition;
_managerPanel.SetManager(this);
Worker newWorker = Globals.Instance._workerScene.Instantiate<Worker>();
newWorker.Position = Globals.Instance._screenCenter + new Vector2(0, 100);
newWorker._id = 1;
newWorker._manager = this;
AddChild(newWorker);
_workers.Add(newWorker);
newWorker = Globals.Instance._workerScene.Instantiate<Worker>();
newWorker.Position = Globals.Instance._screenCenter - new Vector2(0, 100);
newWorker._id = 2;
newWorker._manager = this;
AddChild(newWorker);
_workers.Add(newWorker);
for (int i = 0; i < _workers.Count; i++)
// _managerPanel.SetManager(this);
for (int i = 0; i < Globals.Instance._random.Next(3, 6); i++)
{
GD.Print(i + 1);
_workers[i]._healthBar.Position = _managerPanel.GetNode<Panel>("Team").GetNode<Panel>("T"+(i+1)).GlobalPosition;
AddWorker(null);
}
AwfullyHotCoffeePot newTchotchke = ResourceLoader.Load<PackedScene>("res://Gameplay/Tchotchkes/awfully_hot_coffee_pot.tscn").Instantiate<AwfullyHotCoffeePot>();
newTchotchke.Position = new Vector2(Globals.Instance._screenSize.X - 100, Globals.Instance._screenCenter.Y);
AddChild(newTchotchke);
_tchotckes.Add(newTchotchke);
}
public override void _Process(double DELTA_)
{
ChainMovement();
}
if (_workers.All(w => w._placed && w._primed))
public void AddWorker(Worker NEWWORKER)
{
Worker newWorker = NEWWORKER ?? Globals.Instance._workerScene.Instantiate<Worker>();
newWorker._cell = _desk.GetCellFromAddress(1, 1);
newWorker.Position = newWorker._cell.GlobalPosition;
newWorker._manager = this;
_workers.Add(newWorker);
_workerNode.AddChild(newWorker);
// newWorker.SetHovered += SetHoveredWorker;
}
public void ChainMovement()
{
Vector2 direction = Vector2.Zero;
if (Input.IsActionJustPressed("move_up"))
{
for (int i = 0; i < _workers.Count; i++)
direction = Vector2.Up;
}
else if (Input.IsActionJustPressed("move_down"))
{
direction = Vector2.Down;
}
else if (Input.IsActionJustPressed("move_left"))
{
direction = Vector2.Left;
}
else if (Input.IsActionJustPressed("move_right"))
{
direction = Vector2.Right;
}
if (direction != Vector2.Zero)
{
GD.Print(_cell._row + (int)direction.Y, _cell._column + (int)direction.X);
Cell newCell = _desk.GetCellFromAddress(_cell._row + (int)direction.Y, _cell._column + (int)direction.X);
if (newCell != null)
{
_workers[i].Launch();
GD.Print(_cell._row, _cell._column);
if (_moves.Count > 0)
{
for (int i = 0; i < _workers.Count && i < _moves.Count; i++)
{
_workers[i]._cell = _moves[i];
_workers[i].GlobalPosition = _workers[i]._cell.GlobalPosition;
}
}
_cell = newCell;
_moves.Insert(0, newCell);
_image.GlobalPosition = _cell.GlobalPosition;
}
}
}
@@ -81,6 +121,5 @@ public partial class Manager : Node
{
_imagePath = PATH;
}
}

8
Gameplay/Stat.cs Normal file
View File

@@ -0,0 +1,8 @@
using Godot;
using System;
public partial class Stat : Node
{
public int _default, _effective;
}

1
Gameplay/Stat.cs.uid Normal file
View File

@@ -0,0 +1 @@
uid://dqthihtgdvrx8

View File

@@ -1,84 +1,92 @@
using Godot;
using System;
using System.Collections.Generic;
// using Godot;
// using System;
// using System.Collections.Generic;
// using System.Linq;
public partial class Tchotchke : StaticBody2D
{
public bool _hovered = false, _held = false;
public List<Effect> _effects = new();
// public partial class Tchotchke : StaticBody2D
// {
// public bool _hovered = false, _held = false;
// public List<Action> _actions = new();
// public Node _target;
public override void _Process(double DELTA_)
{
if (_held)
{
GlobalPosition = GetGlobalMousePosition();
if (Input.IsActionJustReleased("left_click"))
{
Transform2D newTransform = GlobalTransform;
newTransform.Origin = Position;
GlobalTransform = newTransform;
Drop();
}
}
else
{
if (_hovered)
{
if (Input.IsActionJustPressed("left_click"))
{
Hold();
}
if (Input.IsActionJustPressed("scroll_up"))
{
Rotation -= 1.0f * (float)(Math.PI) / 180.0f;
}
if (Input.IsActionJustPressed("scroll_down"))
{
Rotation += 1.0f * (float)(Math.PI) / 180.0f;
}
}
}
}
// public override void _Ready()
// {
// MouseEntered += OnMouseEntered;
// MouseExited += OnMouseExited;
// }
public void Drop()
{
if (_held)
{
_held = false;
}
}
// public override void _Process(double DELTA_)
// {
// if (_held)
// {
// GlobalPosition = GetGlobalMousePosition();
// if (Input.IsActionJustReleased("left_click"))
// {
// Transform2D newTransform = GlobalTransform;
// newTransform.Origin = Position;
// GlobalTransform = newTransform;
// Drop();
// }
// }
// else
// {
// if (_hovered)
// {
// if (Input.IsActionJustPressed("left_click"))
// {
// Hold();
// }
// if (Input.IsActionJustPressed("scroll_up"))
// {
// Rotation -= 1.0f * (float)(Math.PI) / 180.0f;
// }
// if (Input.IsActionJustPressed("scroll_down"))
// {
// Rotation += 1.0f * (float)(Math.PI) / 180.0f;
// }
// }
// }
// }
public void Hold()
{
if (_held)
{
return;
}
_held = true;
}
// public void Drop()
// {
// if (_held)
// {
// _held = false;
// }
// }
// Processes
// public void FireActions(Trigger.On TRIGGER, Node TARGET = null)
// {
// List<Action> triggeredActions = _actions.Where(e => e._triggers.IndexOf(TRIGGER) > -1).ToList();
// for (int i = 0; i < triggeredActions.Count; i++)
// {
// triggeredActions[i].Target(TARGET);
// triggeredActions[i].Fire();
// }
// List<Action> expiredActions = _actions.Where(e => e._triggers.IndexOf(TRIGGER) > -1).ToList();
// _actions.Except(expiredActions);
// }
// PRIVATE METHODS
private void OnMouseEntered()
{
_hovered = true;
}
// public void Hold()
// {
// if (_held)
// {
// return;
// }
// _held = true;
// }
private void OnMouseExited()
{
_hovered = false;
}
// // PRIVATE METHODS
// private void OnMouseEntered()
// {
// _hovered = true;
// }
private void OnBodyEntered(Node NODE)
{
if (NODE is Worker)
{
for (int i = 0; i < _effects.Count; i++)
{
GD.Print(1001);
_effects[i].TriggerEffect((Worker)NODE);
}
}
}
}
// private void OnMouseExited()
// {
// _hovered = false;
// }
// }

View File

@@ -1,10 +1,10 @@
using Godot;
using System;
// using Godot;
// using System;
public partial class AwfullyHotCoffeePot : Tchotchke
{
public AwfullyHotCoffeePot() : base()
{
_effects.Add(new Caffeinate(this));
}
}
// public partial class AwfullyHotCoffeePot : Tchotchke
// {
// public AwfullyHotCoffeePot() : base()
// {
// // _actions.Add(new Caffeinate(this));
// }
// }

View File

@@ -1,7 +1,7 @@
using Godot;
using System;
// using Godot;
// using System;
public partial class RedStapler : Tchotchke
{
// public partial class RedStapler : Tchotchke
// {
}
// }

View File

@@ -30,7 +30,3 @@ gravity = 5.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Gravity"]
shape = SubResource("CircleShape2D_yxdnl")
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]
[connection signal="body_entered" from="Gravity" to="." method="OnBodyEntered"]

View File

@@ -29,7 +29,3 @@ gravity = 5.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Gravity"]
shape = SubResource("CapsuleShape2D_1dddf")
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]
[connection signal="body_entered" from="Gravity" to="." method="OnBodyEntered"]

27
Gameplay/Trait.cs Normal file
View File

@@ -0,0 +1,27 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class Trait : Node
{
public Worker _target, _owner;
public List<Trigger.On> _triggers = new();
public List<Trigger.On> _expirations = new();
public Trait(Worker OWNER)
{
_owner = OWNER;
}
public virtual void Fire()
{
}
public virtual void Target(Worker TARGET)
{
_target = TARGET;
}
}

View File

@@ -0,0 +1,26 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class BasicAttack : Trait
{
public BasicAttack(Worker OWNER) : base(OWNER)
{
_triggers.Add(Trigger.On.Collision);
}
public override void Fire()
{
if (_target != null)
{
if (_target._manager != _owner._manager)
{
int damage = -_owner._aptitude._default / 2;
// target.ChangeHealth(damage, owner);
}
}
_target = null;
}
}

View File

@@ -0,0 +1,15 @@
using Godot;
using System;
public partial class Caffeinate : Trait
{
public Caffeinate(Worker OWNER) : base(OWNER)
{
_triggers.Add(Trigger.On.Collision);
}
public override void Fire()
{
}
}

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bih70e65g1108"]
[ext_resource type="Script" uid="uid://2ilonmgvkayp" path="res://Gameplay/Traits/BasicAttack.cs" id="1_egsn3"]
[node name="BasicAttack" type="Node"]
script = ExtResource("1_egsn3")

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bo2rj0albmkkw"]
[ext_resource type="Script" path="res://Gameplay/Effects/Caffeinate.cs" id="1_l8me6"]
[node name="Caffeinate" type="Node"]
script = ExtResource("1_l8me6")

22
Gameplay/Trigger.cs Normal file
View File

@@ -0,0 +1,22 @@
using Godot;
using System;
public partial class Trigger : Node
{
public Timer _timer;
public int _distance;
public enum On
{
Movement,
Collision,
WallCollision,
Death,
Launch,
Stop,
BattleStart,
BattleEnd,
Critical,
Defend,
Time
}
}

1
Gameplay/Trigger.cs.uid Normal file
View File

@@ -0,0 +1 @@
uid://g0mmh73fptyg

View File

@@ -1,178 +1,160 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
public partial class Worker : RigidBody2D
public partial class Worker : Area2D
{
public bool _dead = false, _hovered = false, _held = false, _placed = false, _selected = false, _primed = false, _moving = false;
public int _health, _healthMax, _aptitude, _agility, _ardor, _accumen, _awareness, _appeal, _id;
// [Signal]
// public delegate void SwapPositionsEventHandler(Worker THIS);
public bool _dead = false, _hovered = false, _held = false, _selected = false;
public int _size, _health, _healthMax;
public float _distanceTraveled, _stamina, _staminaMax;
public Stat _aptitude = new(), _agility = new(), _ardor = new(), _accumen = new(), _awareness = new(), _appeal = new();
public float _rotationalForce = 0;
public Vector2 _force = Vector2.Zero;
public Node _collisionTarget;
public Sprite2D _image;
public ProgressBar _healthBar;
public Manager _manager;
public List<Effect> _effects = new();
public Cell _cell;
public List<Trait> _traits = new();
public override void _Ready()
{
_health = 10;
_aptitude = 5;
_agility = 5;
_ardor = 5;
_accumen = 5;
_awareness = 5;
_appeal = 5;
_size = (int)(((CircleShape2D)GetNode<CollisionShape2D>("Bounds").Shape).Radius);
_aptitude._default = 5;
_agility._default = 5;
_ardor._default = 5;
_accumen._default = 5;
_awareness._default = 5;
_appeal._default = 5;
_aptitude._effective = _aptitude._default;
_agility._effective = _agility._default;
_ardor._effective = _ardor._default;
_accumen._effective = _accumen._default;
_awareness._effective = _awareness._default;
_appeal._effective = _appeal._default;
_healthMax = _health;
_image = GetNode<Sprite2D>("Sprite2D");
_effects.Add(new BasicAttack(this));
_traits.Add(new BasicAttack(this));
_healthBar = GetNode<ProgressBar>("HealthBar");
_healthBar.MaxValue = _healthMax;
_healthBar.Value = _health;
// _healthBar = GetNode<ProgressBar>("HealthBar");
// _healthBar.MaxValue = _healthMax;
// _healthBar.Value = _health;
}
public override void _Process(double DELTA_)
{
if (!_moving)
if (_hovered)
{
if (!_placed)
if (Input.IsActionJustPressed("left_click"))
{
if (!_held)
{
if (_hovered)
{
if (Input.IsActionJustPressed("left_click"))
{
Hold();
}
}
}
}
else
{
if (_selected)
{
Vector2 mousePosition = GetGlobalMousePosition();
LookAt(mousePosition);
if (Input.IsActionJustReleased("left_click"))
{
_selected = false;
_force = (GlobalPosition - mousePosition) * 100;
_rotationalForce = 5f;
_primed = true;
}
}
else if (_hovered)
{
if (Input.IsActionJustPressed("left_click"))
{
_selected = true;
}
}
Hold();
}
}
else
{
// Vector2 towardCenter = (Globals.Instance._screenCenter - GlobalPosition).Normalized();
// ApplyCentralForce(towardCenter * 100);
_image.Rotate(_rotationalForce);
_rotationalForce -= 0.5f / 60;
if (_rotationalForce <= 0f)
{
Stop();
}
}
}
public override void _PhysicsProcess(double DELTA_)
{
if (_held)
{
GlobalPosition = GetGlobalMousePosition();
if (Input.IsActionJustReleased("left_click"))
{
Transform2D newTransform = GlobalTransform;
newTransform.Origin = Position;
GlobalTransform = newTransform;
Drop();
}
}
}
public void ChangeHealth(int CHANGE, Node CHANGEMAKER)
{
if (_health <= 0 && CHANGE < 0)
{
// knock the piece off the board and out for the round!
// process on knockout
}
_health += CHANGE;
_healthBar.Value = _health;
if (_health <= 0)
{
Sleeping = true;
_dead = true;
_health = 0;
TriggerSpecificEffects(Effect.Trigger.Death, _manager);
}
}
// public void ChangeHealth(int CHANGE, Node CHANGEMAKER)
// {
// if (_health <= 0 && CHANGE < 0)
// {
// // knock the piece off the board and out for the round!
// // process on knockout
// }
// _health += CHANGE;
// _healthBar.Value = _health;
// if (_health <= 0)
// {
// Sleeping = true;
// _dead = true;
// _health = 0;
// FireActions(Trigger.On.Death, _manager);
// }
// }
public void Drop()
{
if (_held)
{
_held = false;
_placed = true;
Freeze = false;
GlobalPosition = _cell.GlobalPosition;
}
}
public void FireActions(Trigger.On TRIGGER, Worker TARGET = null)
{
for (int i = 0; i < _traits.Count; i++)
{
if (_traits[i]._triggers.Contains(TRIGGER))
{
_traits[i].Target(TARGET);
_traits[i].Fire();
}
}
}
// public bool HasCondition(string CONDITION)
// {
// List<string> conditionNames = _conditions.GetChildren().Select(c => c.GetType().ToString()).ToList();
// return conditionNames.Contains(CONDITION);
// }
public void Hold()
{
if (_held)
{
return;
}
Freeze = true;
_held = true;
}
public void Launch()
public void ResetStats()
{
GravityScale = 1.0f;
_moving = true;
ApplyCentralForce(_force);
_force = Vector2.Zero;
_primed = false;
TriggerSpecificEffects(Effect.Trigger.Launch, _manager);
_aptitude._effective = _aptitude._default;
_agility._effective = _agility._default;
_ardor._effective = _ardor._default;
_accumen._effective = _accumen._default;
_awareness._effective = _awareness._default;
_appeal._effective = _appeal._default;
}
public void Stop()
public void SwapWith(Worker OTHERWORKER)
{
GravityScale = 0.0f;
Sleeping = true;
_moving = false;
_rotationalForce = 0f;
TriggerSpecificEffects(Effect.Trigger.Stop, _manager);
}
Cell thisCell = _cell, otherCell = OTHERWORKER._cell;
public void TriggerSpecificEffects(Effect.Trigger TRIGGER, Node TARGET = null)
{
List<Effect> triggeredEffects = _effects.Where(e => e._trigger.IndexOf(TRIGGER) > -1).ToList();
for (int i = 0; i < triggeredEffects.Count; i++)
{
triggeredEffects[i].TriggerEffect(TARGET);
}
List<Effect> expiredEffects = _effects.Where(e => e._trigger.IndexOf(TRIGGER) > -1).ToList();
_effects.Except(expiredEffects);
OTHERWORKER.GlobalPosition = thisCell.GlobalPosition;
_cell = otherCell;
OTHERWORKER._cell = thisCell;
int indexA = _manager._workers.IndexOf(this), indexB = _manager._workers.IndexOf(OTHERWORKER);
Worker placeholder = this;
_manager._workers[indexA] = OTHERWORKER;
_manager._workers[indexB] = placeholder;
}
// PRIVATE METHODS
private void OnAreaEntered(Area2D AREA)
{
if (AREA is Worker)
{
if (_held)
{
SwapWith((Worker)AREA);
}
}
}
private void OnMouseEntered()
{
_hovered = true;
@@ -183,19 +165,22 @@ public partial class Worker : RigidBody2D
_hovered = false;
}
private void OnBodyEntered(Node NODE)
{
if (NODE is Worker)
{
_collisionTarget = NODE;
TriggerSpecificEffects(Effect.Trigger.Collision, NODE);
// private void OnBodyEntered(Node NODE)
// {
// if (NODE is Worker)
// {
// FireActions(Trigger.On.Collision, NODE);
_rotationalForce *= 0.8f;
Vector2 rotatedForce = LinearVelocity.Rotated(((Worker)NODE)._rotationalForce);
ApplyCentralForce(rotatedForce);
_collisionTarget = null;
}
}
// _rotationalForce *= 0.8f;
// Vector2 rotatedForce = LinearVelocity.Rotated(((Worker)NODE)._rotationalForce);
// ApplyCentralForce(rotatedForce);
// }
// else if (NODE is Tchotchke)
// {
// Tchotchke tchotchke = (Tchotchke)NODE;
// tchotchke.FireActions(Trigger.On.Collision, this);
// }
// }
}

View File

@@ -1,11 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://5ymxo45j4ryt"]
[gd_scene load_steps=2 format=3 uid="uid://5ymxo45j4ryt"]
[ext_resource type="Script" uid="uid://0c1u4l8lu07h" path="res://Gameplay/Battle.cs" id="1_i431l"]
[ext_resource type="PackedScene" uid="uid://demwh8ek37mnx" path="res://Gameplay/desk.tscn" id="2_fkh6t"]
[node name="Battle" type="Node" groups=["battles"]]
script = ExtResource("1_i431l")
[node name="Desk" parent="." instance=ExtResource("2_fkh6t")]
position = Vector2(960, 540)
rotation = 1.5708

6
Gameplay/cell.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://b7yrd35gvisom"]
[ext_resource type="Script" path="res://Gameplay/Cell.cs" id="1_kyub7"]
[node name="Cell" type="Sprite2D"]
script = ExtResource("1_kyub7")

6
Gameplay/condition.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dsrjrwd1eyeu3"]
[ext_resource type="Script" path="res://Gameplay/Condition.cs" id="1_s3ntn"]
[node name="Condition" type="Node"]
script = ExtResource("1_s3ntn")

View File

@@ -1,30 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://demwh8ek37mnx"]
[ext_resource type="Texture2D" uid="uid://w4cxyhjvmkq1" path="res://art/desk.png" id="1_21bwm"]
[ext_resource type="Script" uid="uid://pxi753iie75t" path="res://Gameplay/Desk.cs" id="2_15p4t"]
[ext_resource type="Texture2D" uid="uid://dy4lmwn1dit26" path="res://art/shade.png" id="2_21bwm"]
[ext_resource type="PackedScene" uid="uid://b7yrd35gvisom" path="res://Gameplay/cell.tscn" id="2_ucfrb"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_fw0uc"]
radius = 88.5
height = 566.0
[node name="Desk" type="Sprite2D"]
scale = Vector2(2, 2)
texture = ExtResource("1_21bwm")
[node name="Desk" type="Node2D"]
script = ExtResource("2_15p4t")
[node name="StaticBody2D" type="StaticBody2D" parent="."]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D"]
polygon = PackedVector2Array(34.5, -87.5, 60.5, -87.5, 131.5, -87, 245, -78.5, 251, -77, 265, -55.5, 273, -16, 272.5, 0.5, 269.5, 31, 264, 58, 251, 76, 220.5, 81.5, 144, 85, 54, 87, 0, 87, -88.5, 85, -167, 84.5, -246, 77.5, -260, 62.5, -271.5, 22.5, -272, -0.5, -271.5, -25.5, -266, -47, -257, -70.5, -248, -79, -186.5, -84, -105, -87, -17.5, -87.5, 34.5, -87.5, 35, -335, -418.5, -337, -421, 448, 439, 445, 438.5, -357.5, 35, -334.5)
[node name="Gravity" type="Area2D" parent="."]
[node name="Light" parent="." instance=ExtResource("2_ucfrb")]
visible = false
gravity_space_override = 1
gravity_point = true
gravity_point_center = Vector2(0, 0)
gravity_direction = Vector2(0, 0)
gravity = 100.0
scale = Vector2(0.195, 0.195)
texture = ExtResource("2_21bwm")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Gravity"]
rotation = 1.5708
shape = SubResource("CapsuleShape2D_fw0uc")
[node name="Dark" parent="." instance=ExtResource("2_ucfrb")]
visible = false
modulate = Color(0, 0, 0, 1)
scale = Vector2(0.195, 0.195)
texture = ExtResource("2_21bwm")
[node name="Cells" type="Node2D" parent="."]

View File

@@ -1,3 +0,0 @@
[gd_scene format=3 uid="uid://becqya8l8feni"]
[node name="ProcessEffect" type="Node"]

View File

@@ -1,15 +1,26 @@
[gd_scene load_steps=3 format=3 uid="uid://cdaxqopr35lll"]
[gd_scene load_steps=5 format=3 uid="uid://cdaxqopr35lll"]
[ext_resource type="Script" uid="uid://b66ysicyh0m1s" path="res://Gameplay/Manager.cs" id="1_ivgep"]
[ext_resource type="PackedScene" uid="uid://demwh8ek37mnx" path="res://Gameplay/desk.tscn" id="3_muxv4"]
[ext_resource type="PackedScene" uid="uid://8kv00jc35dma" path="res://Gameplay/manager_panel.tscn" id="3_xooeg"]
[ext_resource type="Texture2D" uid="uid://n0e2tlnwq3e2" path="res://art/manager.png" id="4_2skxn"]
[node name="Manager" type="Node"]
[node name="Manager" type="Node2D"]
script = ExtResource("1_ivgep")
[node name="Panel" parent="." instance=ExtResource("3_xooeg")]
visible = false
offset_left = 101.0
offset_top = 150.0
offset_right = 551.0
offset_bottom = 280.0
grow_horizontal = 1
grow_vertical = 1
[node name="Workers" type="Node" parent="."]
[node name="Desk" parent="." instance=ExtResource("3_muxv4")]
[node name="Image" type="Sprite2D" parent="."]
scale = Vector2(0.5, 0.5)
texture = ExtResource("4_2skxn")

6
Gameplay/stat.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://b8rfuerwno7h1"]
[ext_resource type="Script" uid="uid://dqthihtgdvrx8" path="res://Gameplay/Stat.cs" id="1_kb7kj"]
[node name="Stat" type="Node"]
script = ExtResource("1_kb7kj")

View File

@@ -30,7 +30,3 @@ gravity = 5.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Gravity"]
shape = SubResource("CircleShape2D_d82wc")
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]
[connection signal="body_entered" from="Gravity" to="." method="OnBodyEntered"]

6
Gameplay/trait.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dti20yu8jfujq"]
[ext_resource type="Script" uid="uid://dtccp5uxgkjwm" path="res://Gameplay/Trait.cs" id="1_wtks1"]
[node name="Trait" type="Node"]
script = ExtResource("1_wtks1")

6
Gameplay/trigger.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dufkmbuxx2h41"]
[ext_resource type="Script" uid="uid://g0mmh73fptyg" path="res://Gameplay/Trigger.cs" id="1_opbo1"]
[node name="Trigger" type="Node"]
script = ExtResource("1_opbo1")

View File

@@ -1,53 +1,33 @@
[gd_scene load_steps=5 format=3 uid="uid://37hjd4v3p42o"]
[gd_scene load_steps=4 format=3 uid="uid://37hjd4v3p42o"]
[ext_resource type="Script" uid="uid://bk6qk4rjmsvtn" path="res://Gameplay/Worker.cs" id="1_e314i"]
[ext_resource type="Script" path="res://Gameplay/Worker.cs" id="1_e314i"]
[ext_resource type="Texture2D" uid="uid://dmispjd3fmmks" path="res://art/worker_test.png" id="2_m3kx1"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_e314i"]
bounce = 3.0
[sub_resource type="CircleShape2D" id="CircleShape2D_4poc8"]
radius = 16.0
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_e314i"]
load_path = "res://.godot/imported/beyblade.png-cd6ee3474fe554271afbb31b55fadfb5.ctex"
[sub_resource type="CircleShape2D" id="CircleShape2D_e314i"]
radius = 32.0
[node name="Worker" type="RigidBody2D"]
input_pickable = true
physics_material_override = SubResource("PhysicsMaterial_e314i")
gravity_scale = 0.0
inertia = 1.0
lock_rotation = true
continuous_cd = 2
contact_monitor = true
max_contacts_reported = 1
linear_damp = 0.25
[node name="Worker" type="Area2D"]
script = ExtResource("1_e314i")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
scale = Vector2(0.5, 0.5)
texture = ExtResource("2_m3kx1")
[node name="HealthBar" type="ProgressBar" parent="."]
visible = false
top_level = true
offset_right = 150.0
offset_bottom = 27.0
step = 1.0
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(0.2, 0.2)
texture = SubResource("CompressedTexture2D_e314i")
[node name="Bounds" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_4poc8")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
scale = Vector2(0.2, 0.2)
polygon = PackedVector2Array(8, -171, -17, -171, -17, -169.9, -26.2, -169, -29.5, -169, -62, -151.2, -84, -152.9, -84, -154.4, -102.4, -151, -104.7, -151, -150.8, -114, -153, -114, -174, -88, -175.3, -88, -180, -77.7, -180, 44.2, -178, 46.7, -178, 48.3, -163.5, 54.9, -155, 81.2, -155, 83.9, -135.8, 102, -134.9, 102, -114, 126.7, -114, 128.2, -97.5, 137, -96.1, 137, -92, 143.6, -92, 146, -82, 152.9, -82, 154.5, -34, 167.4, -34, 168.7, -18.1, 171, 31.2, 171, 49.4, 167, 52.7, 167, 68, 155, 68, 154.2, 110.5, 134, 112.7, 134, 137.7, 114, 139.7, 114, 142, 98.1, 142, 92.9, 156.9, 79, 158.4, 79, 171.4, 45, 173.1, 45, 172, 22.9, 172, 13.6, 180, 1.10001, 180, -65.5, 159, -106.6, 159, -108.7, 134, -140.7, 134, -142.3, 121.4, -148, 112.5, -148, 101.4, -142, 97.3, -142, 75, -151.3, 75, -152.5, 50.3, -159, 47.5, -159, 39, -164.1, 39, -165.8, 8, -169.8)
[node name="Actions" type="Node" parent="."]
[node name="Gravity" type="Area2D" parent="."]
gravity_space_override = 1
gravity_point = true
gravity_point_unit_distance = 32.0
gravity_point_center = Vector2(0, 0)
gravity_direction = Vector2(0, 0)
gravity = 5.0
[node name="Conditions" type="Node" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Gravity"]
shape = SubResource("CircleShape2D_e314i")
[connection signal="body_entered" from="." to="." method="OnBodyEntered"]
[connection signal="area_entered" from="." to="." method="OnAreaEntered"]
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]

View File

View File

@@ -1 +0,0 @@
uid://c1bvlokuaveb2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 23 KiB

BIN
art/deskBounds.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

34
art/deskBounds.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c5yof13kvayxo"
path="res://.godot/imported/deskBounds.png-fa23ed94e8b4e04910d1a67af27f113b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/deskBounds.png"
dest_files=["res://.godot/imported/deskBounds.png-fa23ed94e8b4e04910d1a67af27f113b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
art/manager.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

34
art/manager.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://n0e2tlnwq3e2"
path="res://.godot/imported/manager.png-4597b8f1ec81670b0cb0a529dbc77f73.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/manager.png"
dest_files=["res://.godot/imported/manager.png-4597b8f1ec81670b0cb0a529dbc77f73.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
art/tiles.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

34
art/tiles.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c5bxy01morx2o"
path="res://.godot/imported/tiles.png-4bebe0e5cdfc7faf322603713a4a3f81.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/tiles.png"
dest_files=["res://.godot/imported/tiles.png-4bebe0e5cdfc7faf322603713a4a3f81.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
art/worker_test.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dmispjd3fmmks"
path="res://.godot/imported/worker_test.png-8eeda9167e14e3ea47d2777edc77e1ba.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/worker_test.png"
dest_files=["res://.godot/imported/worker_test.png-8eeda9167e14e3ea47d2777edc77e1ba.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1