7-11-25 7:00pm

This commit is contained in:
2025-07-11 19:00:09 -04:00
parent 9057a21613
commit 1d976cf322
75 changed files with 1362 additions and 521 deletions

View File

@@ -3,207 +3,4 @@ using System;
public partial class Ball : RigidBody2D
{
[Signal]
public delegate void HoverEventHandler(bool tf = true);
[Signal]
public delegate void SelectEventHandler(bool tf = true);
[Signal]
public delegate void AimEventHandler(bool tf = true);
[Signal]
public delegate void LaunchEventHandler(bool tf = true);
[Signal]
public delegate void MoveEventHandler(bool tf = true);
[Signal]
public delegate void BumpMarbleEventHandler(Ball ball);
[Signal]
public delegate void DefenseDownEventHandler(int damage);
public bool _holding, _placed, _hovered, _selected, _aimed, _launched, _moving;
public int _defense, _defenseMax, _speed;
public Vector2 _force, _velocity, _screenSize;
public override void _Ready()
{
_holding = false;
_placed = false;
_hovered = false;
_selected = false;
_aimed = false;
_launched = false;
_moving = false;
_defense = 10;
_defenseMax = _defense;
_speed = 400;
_force = new Vector2(0,0);
_velocity = new Vector2(0,0);
_screenSize = GetViewportRect().Size;
Hide();
}
public override void _PhysicsProcess(double delta) //THIS IS LIKE THE UPDATE FUNCTION
{
Rotation = 0;
if (_placed)
{
TrySelect();
TryAim();
TryLaunch();
TryMovement(delta);
}
else if (_holding)
{
//GetNode<CollisionShape2D>("Bounds").Disabled = true;
Vector2 mousePosition = GetGlobalMousePosition();
if (Input.IsActionJustReleased("left_click"))
{
Start(mousePosition);
}
}
}
public void DefenseChange(int change)
{
_defense += change;
if (_defense < 0)
{
EmitSignal(SignalName.DefenseDown); // transfer damage over 0 to player
_defense = 0; // set defense back to 0
}
}
public void Start(Vector2 position)
{
_holding = false;
_placed = true;
Position = position;
Show();
GetNode<CollisionShape2D>("Bounds").Disabled = false;
}
public void TryAim()
{
if (_selected && Input.IsActionPressed("left_click") && ! _hovered && !_aimed)
{
_aimed = true;
EmitSignal(SignalName.Aim);
}
if (_aimed)
{
Vector2 mousePosition = GetGlobalMousePosition();
_force = Position - mousePosition;
if (!Input.IsActionPressed("left_click"))
{
if (!_hovered)
{
_launched = true;
EmitSignal(SignalName.Select, false);
}
else
{
_aimed = false;
EmitSignal(SignalName.Aim, false);
}
}
}
}
public void TryLaunch()
{
if (_aimed && Input.IsActionJustReleased("left_click"))
{
_selected = false;
EmitSignal(SignalName.Select, false);
_aimed = false;
EmitSignal(SignalName.Aim, false);
_launched = true;
EmitSignal(SignalName.Launch);
ApplyCentralForce(_force * _speed);
_force = Vector2.Zero;
}
}
public void TryMovement(double delta)
{
if (LinearVelocity.Length() > 0 && !Sleeping)
{
if (!_moving)
{
_moving = true;
EmitSignal(SignalName.Move);
}
}
if (_moving)
{
//Vector2 Scroll = -LinearVelocity / 100;
//
//Sprite2D sprite = (Sprite2D)GetNode("Texture");
//ShaderMaterial material = (ShaderMaterial)sprite.Material;
//
//float CurrentScrollX = (float)material.GetShaderParameter("scroll_x");
//material.SetShaderParameter("scroll_x", (CurrentScrollX + Scroll.X * (float)delta) % 1.0f);
//
//float CurrentScrollY = (float)material.GetShaderParameter("scroll_y");
//material.SetShaderParameter("scroll_y", (CurrentScrollY + Scroll.Y * (float)delta) % 1.0f);
if (Sleeping)
{
_launched = false;
_moving = false;
EmitSignal(SignalName.Move, false);
}
}
}
public void TrySelect()
{
if ( _hovered)
{
if (Input.IsActionJustPressed("left_click") && !_selected)
{
_selected = true;
EmitSignal(SignalName.Select);
}
}
if (_selected)
{
if (!_hovered)
{
if (Input.IsActionJustPressed("left_click") && _selected)
{
_selected = false;
EmitSignal(SignalName.Select, false);
}
}
}
}
private void OnMouseEntered()
{
_hovered = true;
EmitSignal(SignalName.Hover);
}
private void OnMouseExited()
{
_hovered = false;
EmitSignal(SignalName.Hover, false);
}
private void OnBodyEntered(Node2D body)
{
if (body.GetType() == typeof(Ball))
{
EmitSignal(SignalName.BumpMarble, (Ball)body);
}
}
}

View File

@@ -1 +1 @@
uid://b1bipn8tmpggr
uid://dgdxx8tceiljg

40
Gameplay/Cue.cs Normal file
View File

@@ -0,0 +1,40 @@
using Godot;
using System;
public partial class Cue : Sprite2D
{
[Signal]
public delegate void ShootEventHandler(Vector2 impulse);
public float _power = 0.0f;
public int _powerDirection = 1;
public override void _Process(double delta)
{
Vector2 mousePosition = GetViewport().GetMousePosition();
LookAt(mousePosition);
if (Input.IsActionPressed("left_click"))
{
_power += 0.1f * _powerDirection;
if (_power >= ((Main)GetParent())._maxPower)
{
_powerDirection = -1;
}
else if (_power <= 0)
{
_powerDirection = 1;
}
}
else
{
if (_power > 0f)
{
_powerDirection = 1;
Vector2 direction = mousePosition - Position;
EmitSignal(SignalName.Shoot, _power * direction);
_power = 0;
}
}
}
}

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

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

View File

@@ -1,24 +1,173 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
public partial class Main : Node
{
// Don't forget to rebuild the project so the editor knows about the new export variable.
[Export]
public PackedScene BallScene;
public bool _takingShot, _cueBallPotted;
public float _maxPower = 8.0f, _moveThreshold = 5.0f;
public Vector2 _startPosition = new Vector2(890, 340);
public Ball _cueBall;
public List<Texture2D> _ballImages = new();
public List<Sprite2D> _potted = new();
public override void _Ready()
{
LoadBallImages();
NewGame();
List<Area2D> pockets = GetNode<Table>("Table").GetChildren().Where(n => n.GetName().ToString().ToLower().Contains("pocket")).Select(n => (Area2D)n).ToList<Area2D>();
for (int i = 0; i < pockets.Count; i++)
{
pockets[i].BodyEntered += PottedBall;
}
//GetNode<Table>("Table").GetNode<Area2D>("PocketTL").BodyEntered += PottedBall;
//GetNode<Table>("Table").GetNode<Area2D>("PocketTR").BodyEntered += PottedBall;
//GetNode<Table>("Table").GetNode<Area2D>("PocketR").BodyEntered += PottedBall;
//GetNode<Table>("Table").GetNode<Area2D>("PocketBR").BodyEntered += PottedBall;
//GetNode<Table>("Table").GetNode<Area2D>("PocketBL").BodyEntered += PottedBall;
//GetNode<Table>("Table").GetNode<Area2D>("PocketL").BodyEntered += PottedBall;
}
public override void _Process(double delta_)
{
bool moving = false;
List<Ball> balls = GetTree().GetNodesInGroup("balls").Select(b => (Ball)b).ToList<Ball>();
for (int i = 0; i < balls.Count; i++)
{
if (balls[i].LinearVelocity.Length() > 0 && balls[i].LinearVelocity.Length() < _moveThreshold)
{
balls[i].Sleeping = true;
}
else if (balls[i].LinearVelocity.Length() >= _moveThreshold)
{
moving = true;
}
}
if (!moving)
{
if (_cueBallPotted)
{
ResetCueBall();
_cueBallPotted = false;
}
if (!_takingShot)
{
_takingShot = true;
ShowCue();
}
}
else
{
if (_takingShot)
{
_takingShot = false;
HideCue();
}
}
}
public void GenerateBalls()
{
int count = 0;
int rows = 5;
int diameter = 36;
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < rows; j++)
{
Ball ball = BallScene.Instantiate<Ball>();
Vector2 position = new Vector2(250 + (i*(diameter)), 267 + (j*(diameter)) + (i*(diameter / 2)));
AddChild(ball);
ball.Position = position;
ball.GetNode<Sprite2D>("Texture").Texture = _ballImages[count];
count += 1;
}
rows -= 1;
}
}
public void HideCue()
{
GetNode<Cue>("Cue").SetProcess(false);
GetNode<Cue>("Cue").Hide();
GetNode<ProgressBar>("PowerBar").Hide();
}
public void LoadBallImages()
{
_ballImages.Clear();
for (int i = 1; i < 17; i++)
{
string fileName = "res://art/ball_"+i+".png";
Texture2D image = GD.Load<Texture2D>(fileName);
_ballImages.Add(image);
}
}
public void NewGame()
{
Player player = new Player();
//Marker2D enemyStart = GetNode<Marker2D>("EnemyStart");
//Cog enemy = GetNode<Cog>("Enemy");
//enemy.PlaceMarble(enemyStart.Position);
//
//Cog player = GetNode<Cog>("Player");
//player.HoldMarble();
ResetCueBall();
GenerateBalls();
ShowCue();
}
public void PottedBall(Node2D body)
{
if (body == _cueBall)
{
_cueBallPotted = true;
RemoveCueBall();
}
else
{
Sprite2D ballSprite = new Sprite2D();
AddChild(ballSprite);
ballSprite.Texture = body.GetNode<Sprite2D>("Texture").Texture;
_potted.Add(ballSprite);
ballSprite.Position = new Vector2(50 * _potted.Count, 725);
body.QueueFree();
}
//GetNode<Table>("Table").GetNode<Area2D>("Pockets").GetNode<Area2D>("Pockets")
}
public void RemoveCueBall()
{
Ball oldCueBall = _cueBall;
RemoveChild(oldCueBall);
oldCueBall.QueueFree();
}
public void ResetCueBall()
{
_cueBall = BallScene.Instantiate<Ball>();
AddChild(_cueBall);
_cueBall.Position = _startPosition;
_cueBall.GetNode<Sprite2D>("Texture").Texture = _ballImages[^1];
_takingShot = false;
}
public void ShowCue()
{
GetNode<Cue>("Cue").SetProcess(true);
GetNode<Cue>("Cue").Position = _cueBall.Position;
GetNode<ProgressBar>("PowerBar").Position = new Vector2(_cueBall.Position.X - GetNode<ProgressBar>("PowerBar").Size.X / 2, _cueBall.Position.Y + GetNode<ProgressBar>("PowerBar").Size.Y / 2);
GetNode<Cue>("Cue").Show();
GetNode<ProgressBar>("PowerBar").Show();
}
private void OnCueShoot(Vector2 impulse)
{
_cueBall.ApplyCentralImpulse(impulse);
}
}

View File

@@ -1,16 +0,0 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class Player : Node
{
public List<Shark> _sharks;
public List<SharkHud> _sharkHuds;
public override void _Ready()
{
}
}

View File

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

15
Gameplay/PowerBar.cs Normal file
View File

@@ -0,0 +1,15 @@
using Godot;
using System;
public partial class PowerBar : ProgressBar
{
public override void _Ready()
{
}
public override void _Process(double delta)
{
Value = ((Main)GetParent()).GetNode<Cue>("Cue")._power / ((Main)GetParent())._maxPower * 100;
}
}

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

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

View File

@@ -1,69 +0,0 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class Shark : Node2D
{
public bool _dead;
public int _aptitude, _agility, _ardor, _accuity, _awareness, _appeal, _health, _healthMax, _energy, _energyMax, _stamina, _staminaMax, _burden, _turnBandwidth, _turnBandwidthMax, _battleBandwidth, _criticalChance;
public string _name;
public SharkHud _hud;
public List<Ball> _balls = new();
public override void _Ready()
{
_name = "Sample Cog";
_dead = false;
_aptitude = 10; // ball launch speed / strength
_agility = 10; // ball launch stamina
_ardor = 10; // ball defense
_accuity = 10; // ball
_awareness = 10;
_appeal = 10;
_health = _ardor * 12;
_healthMax = _health;
_energy = _accuity * 12;
_energyMax = _energy;
_stamina = _agility * 12;
_staminaMax = _stamina;
_burden = _appeal / 12;
_turnBandwidth = (int)(_awareness * 2 / 3);
_turnBandwidthMax = _turnBandwidth;
_battleBandwidth = _turnBandwidthMax * 4;
_criticalChance = 10;
}
public void Attack(Ball target)
{
Ball ball = GetNode<Ball>("Ball");
if (ball._launched)
{
target.DefenseChange(-3);
}
}
public void HealthChange(int change)
{
_health += change;
if (_health < 0)
{
_dead = true;
}
}
public void HoldBall()
{
Ball ball = GetNode<Ball>("Ball");
ball._holding = true;
}
public void PlaceBall(Vector2 position)
{
Ball ball = GetNode<Ball>("Ball");
ball.Start(position);
}
}

View File

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

View File

@@ -1,25 +0,0 @@
using Godot;
using System;
public partial class SharkHud : CanvasLayer
{
public void LoadCog(Shark shark)
{
RichTextLabel name = (RichTextLabel)GetNode("CogName");
Sprite2D sprite = (Sprite2D)GetNode("Icon");
RichTextLabel health = (RichTextLabel)GetNode("HealthValue");
RichTextLabel energy = (RichTextLabel)GetNode("EnergyValue");
RichTextLabel bandwidth = (RichTextLabel)GetNode("BandwidthValue");
RichTextLabel healthMax = (RichTextLabel)GetNode("HealthMax");
RichTextLabel energyMax = (RichTextLabel)GetNode("EnergyMax");
RichTextLabel bandwidthMax = (RichTextLabel)GetNode("BandwidthMax");
name.Text = shark._name;
health.Text = shark._health.ToString();
energy.Text = shark._energy.ToString();
bandwidth.Text = shark._turnBandwidth.ToString();
healthMax.Text = shark._healthMax.ToString();
energyMax.Text = shark._energyMax.ToString();
bandwidthMax.Text = shark._turnBandwidthMax.ToString();
}
}

View File

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

View File

@@ -1,13 +1,15 @@
[gd_scene load_steps=8 format=3 uid="uid://c8n4lue2bn25n"]
[gd_scene load_steps=9 format=3 uid="uid://c8n4lue2bn25n"]
[ext_resource type="Script" uid="uid://b1bipn8tmpggr" path="res://Gameplay/Ball.cs" id="1_7ritg"]
[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"]
[ext_resource type="Texture2D" uid="uid://dy4lmwn1dit26" path="res://art/shade.png" id="3_yj7wd"]
[ext_resource type="Texture2D" uid="uid://duy62uv828xcg" path="res://art/shadow.png" id="4_803qd"]
[ext_resource type="Texture2D" uid="uid://c4jron4g4jalp" path="res://art/shine.png" id="5_fkve3"]
[ext_resource type="FontFile" uid="uid://dave7ql2luyk1" path="res://fonts/Xolonium-Regular.ttf" id="6_0l1om"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bdlqm"]
resource_local_to_scene = true
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_yj7wd"]
bounce = 5.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_yj7wd"]
shader = ExtResource("2_6v01e")
shader_parameter/scroll_x = 0.0
shader_parameter/scroll_y = 0.0
@@ -15,36 +17,49 @@ shader_parameter/rotation = 0.0
shader_parameter/globe_magnitude = 0.0
[sub_resource type="CircleShape2D" id="CircleShape2D_803qd"]
radius = 60.0
radius = 18.0
[node name="Ball" type="RigidBody2D"]
[node name="Ball" type="RigidBody2D" groups=["balls"]]
input_pickable = true
gravity_scale = 0.0
linear_damp = 2.0
physics_material_override = SubResource("PhysicsMaterial_yj7wd")
continuous_cd = 2
contact_monitor = true
max_contacts_reported = 1
script = ExtResource("1_7ritg")
metadata/_edit_group_ = true
[node name="Texture" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_bdlqm")
scale = Vector2(0.46875, 0.46875)
texture = ExtResource("3_yj7wd")
[node name="Shadow" type="Sprite2D" parent="."]
visible = false
position = Vector2(0, -9.36601e-08)
scale = Vector2(0.46875, 0.46875)
texture = ExtResource("4_803qd")
[node name="Shine" type="Sprite2D" parent="."]
visible = false
position = Vector2(0, -9.36601e-08)
scale = Vector2(0.47712, 0.47712)
texture = ExtResource("5_fkve3")
texture_filter = 1
material = SubResource("ShaderMaterial_yj7wd")
[node name="Bounds" type="CollisionShape2D" parent="."]
position = Vector2(0, -7.10543e-15)
shape = SubResource("CircleShape2D_803qd")
[node name="Shadow" type="Sprite2D" parent="."]
visible = false
position = Vector2(0, -9.36601e-08)
scale = Vector2(0.148438, 0.148438)
texture = ExtResource("4_803qd")
[node name="Shine" type="Sprite2D" parent="."]
visible = false
position = Vector2(0, -9.36601e-08)
scale = Vector2(0.046875, 0.046875)
texture = ExtResource("5_fkve3")
[node name="Number" type="Label" parent="."]
visible = false
offset_left = -9.0
offset_top = -10.0
offset_right = 9.0
offset_bottom = 10.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_fonts/font = ExtResource("6_0l1om")
theme_override_font_sizes/font_size = 10
text = "#"
horizontal_alignment = 1
vertical_alignment = 1
[connection signal="body_entered" from="." to="." method="OnBodyEntered"]
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]

10
Gameplay/cue.tscn Normal file
View File

@@ -0,0 +1,10 @@
[gd_scene load_steps=3 format=3 uid="uid://dm4xk16ce0j"]
[ext_resource type="Texture2D" uid="uid://qs3fa665l8x2" path="res://art/cue.png" id="1_ujx86"]
[ext_resource type="Script" uid="uid://ian15gmia0uv" path="res://Gameplay/Cue.cs" id="2_dtogv"]
[node name="Cue" type="Sprite2D"]
z_index = 99
texture_filter = 1
texture = ExtResource("1_ujx86")
script = ExtResource("2_dtogv")

View File

@@ -1,6 +1,45 @@
[gd_scene load_steps=2 format=3 uid="uid://yqtgkxjjexag"]
[gd_scene load_steps=9 format=3 uid="uid://yqtgkxjjexag"]
[ext_resource type="Script" uid="uid://v6ovq4snxruc" path="res://Gameplay/Main.cs" id="1_0xm2m"]
[ext_resource type="PackedScene" uid="uid://dsprg4uahkylm" path="res://table.tscn" id="2_vkc8e"]
[ext_resource type="PackedScene" uid="uid://c8n4lue2bn25n" path="res://Gameplay/ball.tscn" id="3_u78cq"]
[ext_resource type="PackedScene" uid="uid://dm4xk16ce0j" path="res://Gameplay/cue.tscn" id="4_u78cq"]
[ext_resource type="Script" uid="uid://dbfpn1p62siat" path="res://Gameplay/PowerBar.cs" id="5_tivnh"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tivnh"]
bg_color = Color(0.111197, 0.111197, 0.111197, 1)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ajequ"]
bg_color = Color(1, 1, 1, 0.458824)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_aytjx"]
bg_color = Color(0.92549, 0.0901961, 0.0627451, 1)
[node name="Main" type="Node"]
script = ExtResource("1_0xm2m")
BallScene = ExtResource("3_u78cq")
[node name="Table" parent="." instance=ExtResource("2_vkc8e")]
[node name="PottedPanel" type="Panel" parent="."]
offset_top = 678.0
offset_right = 1200.0
offset_bottom = 778.0
theme_override_styles/panel = SubResource("StyleBoxFlat_tivnh")
[node name="Cue" parent="." instance=ExtResource("4_u78cq")]
[node name="PowerBar" type="ProgressBar" parent="."]
z_index = 1
offset_right = 100.0
offset_bottom = 30.0
theme_override_styles/background = SubResource("StyleBoxFlat_ajequ")
theme_override_styles/fill = SubResource("StyleBoxFlat_aytjx")
show_percentage = false
script = ExtResource("5_tivnh")
[connection signal="Shoot" from="Cue" to="." method="OnCueShoot"]

208
Gameplay/oldball.cs Normal file
View File

@@ -0,0 +1,208 @@
//using Godot;
//using System;
//
//public partial class Ball : RigidBody2D
//{
//[Signal]
//public delegate void HoverEventHandler(bool tf = true);
//[Signal]
//public delegate void SelectEventHandler(bool tf = true);
//[Signal]
//public delegate void AimEventHandler(bool tf = true);
//[Signal]
//public delegate void LaunchEventHandler(bool tf = true);
//[Signal]
//public delegate void MoveEventHandler(bool tf = true);
//[Signal]
//public delegate void BumpMarbleEventHandler(Ball ball);
//[Signal]
//public delegate void DefenseDownEventHandler(int damage);
//
//public bool _holding, _placed, _hovered, _selected, _aimed, _launched, _moving;
//public int _defense, _defenseMax, _speed;
//public Vector2 _force, _velocity, _screenSize;
//
//
//public override void _Ready()
//{
//_holding = false;
//_placed = true;
//_hovered = false;
//_selected = false;
//_aimed = false;
//_launched = false;
//_moving = false;
//_defense = 10;
//_defenseMax = _defense;
//_speed = 400;
//_force = new Vector2(0,0);
//_velocity = new Vector2(0,0);
//_screenSize = GetViewportRect().Size;
//
////Hide();
//}
//
//public override void _PhysicsProcess(double delta) //THIS IS LIKE THE UPDATE FUNCTION
//{
//if (_placed)
//{
//TrySelect();
//TryAim();
//TryLaunch();
//TryMovement(delta);
//}
//else if (_holding)
//{
//GetNode<CollisionShape2D>("Bounds").Disabled = true;
//Vector2 mousePosition = GetGlobalMousePosition();
//if (Input.IsActionJustReleased("left_click"))
//{
//Start(mousePosition);
//}
//}
//}
//
//public void DefenseChange(int change)
//{
//_defense += change;
//if (_defense < 0)
//{
//EmitSignal(SignalName.DefenseDown); // transfer damage over 0 to player
//_defense = 0; // set defense back to 0
//}
//}
//
//public void Start(Vector2 position)
//{
//
//_holding = false;
//_placed = true;
//Position = position;
//Show();
//GetNode<CollisionShape2D>("Bounds").Disabled = false;
//}
//
//public void TryAim()
//{
//if (_selected && Input.IsActionPressed("left_click") && ! _hovered && !_aimed)
//{
//_aimed = true;
//EmitSignal(SignalName.Aim);
//}
//
//if (_aimed)
//{
//Vector2 mousePosition = GetGlobalMousePosition();
//_force = (Position - mousePosition) /6;
//
//if (!Input.IsActionPressed("left_click"))
//{
//if (!_hovered)
//{
//_launched = true;
//EmitSignal(SignalName.Select, false);
//}
//else
//{
//_aimed = false;
//EmitSignal(SignalName.Aim, false);
//}
//}
//}
//}
//
//public void TryLaunch()
//{
//if (_aimed && Input.IsActionJustReleased("left_click"))
//{
//_selected = false;
//EmitSignal(SignalName.Select, false);
//
//_aimed = false;
//EmitSignal(SignalName.Aim, false);
//
//_launched = true;
//EmitSignal(SignalName.Launch);
//
//ApplyCentralForce(_force * _speed);
//_force = Vector2.Zero;
//}
//}
//
//public void TryMovement(double delta)
//{
//if (LinearVelocity.Length() > 0 && !Sleeping)
//{
//if (!_moving)
//{
//_moving = true;
//EmitSignal(SignalName.Move);
//}
//}
//if (_moving)
//{
////Vector2 Scroll = -LinearVelocity / 100;
////
////Sprite2D sprite = (Sprite2D)GetNode("Texture");
////ShaderMaterial material = (ShaderMaterial)sprite.Material;
////
////float CurrentScrollX = (float)material.GetShaderParameter("scroll_x");
////material.SetShaderParameter("scroll_x", (CurrentScrollX + Scroll.X * (float)delta) % 1.0f);
////
////float CurrentScrollY = (float)material.GetShaderParameter("scroll_y");
////material.SetShaderParameter("scroll_y", (CurrentScrollY + Scroll.Y * (float)delta) % 1.0f);
//
//
//if (Sleeping)
//{
//_launched = false;
//_moving = false;
//EmitSignal(SignalName.Move, false);
//}
//}
//}
//
//public void TrySelect()
//{
//if ( _hovered)
//{
//if (Input.IsActionJustPressed("left_click") && !_selected)
//{
//_selected = true;
//EmitSignal(SignalName.Select);
//}
//}
//
//if (_selected)
//{
//if (!_hovered)
//{
//if (Input.IsActionJustPressed("left_click") && _selected)
//{
//_selected = false;
//EmitSignal(SignalName.Select, false);
//}
//}
//}
//}
//
//private void OnMouseEntered()
//{
//_hovered = true;
//EmitSignal(SignalName.Hover);
//}
//
//private void OnMouseExited()
//{
//_hovered = false;
//EmitSignal(SignalName.Hover, false);
//}
//
//private void OnBodyEntered(Node2D body)
//{
//if (body.GetType() == typeof(Ball))
//{
//EmitSignal(SignalName.BumpMarble, (Ball)body);
//}
//}
//}

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

@@ -0,0 +1 @@
uid://2rh2m60aldei

View File

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

View File

@@ -1,9 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://s0dbttuctm8"]
[ext_resource type="Script" uid="uid://b8ppwhc4hl0uk" path="res://Gameplay/Shark.cs" id="1_tsf7f"]
[ext_resource type="PackedScene" uid="uid://c8n4lue2bn25n" path="res://Gameplay/ball.tscn" id="2_unqi5"]
[node name="Shark" type="Node2D"]
script = ExtResource("1_tsf7f")
[node name="Ball" parent="." instance=ExtResource("2_unqi5")]

View File

@@ -1,145 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://cw2ypbamocty5"]
[ext_resource type="Script" uid="uid://cq3svhk85p2ep" path="res://Gameplay/SharkHud.cs" id="1_6jj1n"]
[ext_resource type="Texture2D" uid="uid://dy4lmwn1dit26" path="res://art/shade.png" id="2_t8tri"]
[node name="SharkHud" type="CanvasLayer"]
script = ExtResource("1_6jj1n")
[node name="Background" type="Sprite2D" parent="."]
position = Vector2(98, -128)
scale = Vector2(0.765625, 1)
texture = ExtResource("2_t8tri")
[node name="SharkView" type="Node2D" parent="."]
[node name="SharkName" type="RichTextLabel" parent="SharkView"]
offset_left = 7.0
offset_top = -240.0
offset_right = 174.0
offset_bottom = -217.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Cog Name"
vertical_alignment = 1
[node name="Icon" type="Sprite2D" parent="SharkView"]
position = Vector2(98, -159)
scale = Vector2(0.328125, 0.328125)
texture = ExtResource("2_t8tri")
[node name="HealthLabel" type="RichTextLabel" parent="SharkView"]
offset_left = 7.01563
offset_top = -105.0
offset_right = 107.016
offset_bottom = -82.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Health"
vertical_alignment = 1
[node name="EnergyLabel" type="RichTextLabel" parent="SharkView"]
offset_left = 7.01563
offset_top = -75.0
offset_right = 107.016
offset_bottom = -52.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Energy"
vertical_alignment = 1
[node name="BandwidthLabel" type="RichTextLabel" parent="SharkView"]
offset_left = 7.01563
offset_top = -45.0
offset_right = 107.016
offset_bottom = -22.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Bandwidth"
vertical_alignment = 1
[node name="HealthValue" type="RichTextLabel" parent="SharkView"]
offset_left = 94.0
offset_top = -105.0
offset_right = 144.0
offset_bottom = -82.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Value"
horizontal_alignment = 2
vertical_alignment = 1
[node name="EnergyValue" type="RichTextLabel" parent="SharkView"]
offset_left = 94.0
offset_top = -75.0
offset_right = 144.0
offset_bottom = -52.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Value"
horizontal_alignment = 2
vertical_alignment = 1
[node name="BandwidthValue" type="RichTextLabel" parent="SharkView"]
offset_left = 94.0
offset_top = -45.0
offset_right = 144.0
offset_bottom = -22.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Value"
horizontal_alignment = 2
vertical_alignment = 1
[node name="HealthMax" type="RichTextLabel" parent="SharkView"]
offset_left = 137.0
offset_top = -105.0
offset_right = 187.0
offset_bottom = -82.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Max"
horizontal_alignment = 2
vertical_alignment = 1
[node name="EnergyMax" type="RichTextLabel" parent="SharkView"]
offset_left = 137.0
offset_top = -75.0
offset_right = 187.0
offset_bottom = -52.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Max"
horizontal_alignment = 2
vertical_alignment = 1
[node name="BandwidthMax" type="RichTextLabel" parent="SharkView"]
offset_left = 137.0
offset_top = -45.0
offset_right = 187.0
offset_bottom = -22.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Max"
horizontal_alignment = 2
vertical_alignment = 1
[node name="HealthDivider" type="RichTextLabel" parent="SharkView"]
offset_left = 123.0
offset_top = -105.0
offset_right = 173.0
offset_bottom = -82.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "/"
horizontal_alignment = 1
vertical_alignment = 1
[node name="EnergyDivider" type="RichTextLabel" parent="SharkView"]
offset_left = 123.0
offset_top = -75.0
offset_right = 173.0
offset_bottom = -52.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "/"
horizontal_alignment = 1
vertical_alignment = 1
[node name="BandwidthDivider" type="RichTextLabel" parent="SharkView"]
offset_left = 123.0
offset_top = -45.0
offset_right = 173.0
offset_bottom = -22.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "/"
horizontal_alignment = 1
vertical_alignment = 1