7-10-25 11:32am7-10-25 11:32am7-10-25 11:32am7-10-25 11:32am7-10-25

11:32am7-10-25 11:32am7-10-25 11:32am7-10-25 11:32am7-10-25
11:32am7-10-25 11:32am
This commit is contained in:
2025-07-10 11:31:52 -04:00
parent 1c1266fd25
commit 9057a21613
24 changed files with 595 additions and 463 deletions

209
Gameplay/Ball.cs Normal file
View File

@@ -0,0 +1,209 @@
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 = 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,58 +0,0 @@
using Godot;
using System;
public partial class Cog : Node2D
{
[Export]
public int Aptitude = 10, Agility = 10, Ardor = 10, Accuity = 10, Awareness = 10, Appeal = 10;
public bool _dead;
public int _health, _healthMax, _energy, _energyMax, _stamina, _staminaMax, _burden, _turnBandwidth, _turnBandwidthMax, _battleBandwidth, _criticalChance;
public override void _Ready()
{
_dead = false;
_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(Marble target)
{
Marble marble = GetNode<Marble>("Marble");
if (marble.Launched)
{
target.DefenseChange(-3);
}
}
public void HealthChange(int change)
{
_health += change;
if (_health < 0)
{
_dead = true;
}
}
public void HoldMarble()
{
Marble marble = GetNode<Marble>("Marble");
marble.Holding = true;
}
public void PlaceMarble(Vector2 position)
{
Marble marble = GetNode<Marble>("Marble");
marble.Start(position);
}
}

View File

@@ -11,13 +11,13 @@ public partial class Main : Node
public void NewGame()
{
//_score = 0;
Marker2D enemyStart = GetNode<Marker2D>("EnemyStart");
Cog enemy = GetNode<Cog>("Enemy");
enemy.PlaceMarble(enemyStart.Position);
Cog player = GetNode<Cog>("Player");
player.HoldMarble();
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();
}

View File

@@ -1,206 +0,0 @@
using Godot;
using System;
public partial class Marble : RigidBody2D
{
// Don't forget to rebuild the project so the editor knows about the new signal.
[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(Marble marble);
[Signal]
public delegate void DefenseDownEventHandler(int damage);
[Export]
public bool Holding = false, Placed = false, Hovered = false, Selected = false, Aimed = false, Launched = false, Moving = false;
[Export]
public int Defense = 10, Speed = 400;
[Export]
public Vector2 Force = Vector2.Zero, Velocity = Vector2.Zero;
[Export]
public Vector2 ScreenSize; // Size of the game window.
public int _defenseMax;
public override void _Ready()
{
ScreenSize = GetViewportRect().Size;
_defenseMax = Defense;
//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;
Position = GetGlobalMousePosition();
if (Input.IsActionJustReleased("left_click"))
{
Start(Position);
}
}
}
public void DefenseChange(int change)
{
Defense += change;
if (Defense < 0)
{
EmitSignal(SignalName.DefenseDown, Defense); // 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;
//Rotation = Force.Angle() - 180; // if i want to implement this i need to work out the shader to accept rotation
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(Marble))
{
EmitSignal(SignalName.BumpMarble, (Marble)body);
}
}
}

16
Gameplay/Player.cs Normal file
View File

@@ -0,0 +1,16 @@
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()
{
}
}

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

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

69
Gameplay/Shark.cs Normal file
View File

@@ -0,0 +1,69 @@
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);
}
}

25
Gameplay/SharkHud.cs Normal file
View File

@@ -0,0 +1,25 @@
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();
}
}

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

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

View File

@@ -1,52 +1,48 @@
[gd_scene load_steps=9 format=3 uid="uid://c8n4lue2bn25n"]
[gd_scene load_steps=8 format=3 uid="uid://c8n4lue2bn25n"]
[ext_resource type="Script" uid="uid://b1bipn8tmpggr" path="res://Gameplay/Marble.cs" id="1_7ritg"]
[ext_resource type="Script" uid="uid://b1bipn8tmpggr" 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://dd3s6x86dgxem" path="res://art/checkerboard.png" id="3_o5glk"]
[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"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_803qd"]
bounce = 1.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bdlqm"]
resource_local_to_scene = true
shader = ExtResource("2_6v01e")
shader_parameter/scroll_x = 0.0
shader_parameter/scroll_y = 0.0
shader_parameter/globe_magnitude = 1.0
shader_parameter/rotation = 0.0
shader_parameter/globe_magnitude = 0.0
[sub_resource type="CircleShape2D" id="CircleShape2D_803qd"]
radius = 60.0
[node name="Marble" type="RigidBody2D"]
[node name="Ball" type="RigidBody2D"]
input_pickable = true
mass = 3.0
physics_material_override = SubResource("PhysicsMaterial_803qd")
gravity_scale = 0.0
contact_monitor = true
max_contacts_reported = 1
linear_damp = 2.0
script = ExtResource("1_7ritg")
metadata/_edit_group_ = true
[node name="Texture" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_bdlqm")
position = Vector2(0, 1.3113e-06)
scale = Vector2(1.2, 1.2)
texture = ExtResource("3_o5glk")
scale = Vector2(0.46875, 0.46875)
texture = ExtResource("3_yj7wd")
[node name="Shadow" type="Sprite2D" parent="Texture"]
position = Vector2(0, -1.1708e-06)
scale = Vector2(0.390625, 0.390625)
[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="Texture"]
position = Vector2(0, -1.1708e-06)
scale = Vector2(0.3976, 0.3976)
[node name="Shine" type="Sprite2D" parent="."]
visible = false
position = Vector2(0, -9.36601e-08)
scale = Vector2(0.47712, 0.47712)
texture = ExtResource("5_fkve3")
[node name="Bounds" type="CollisionShape2D" parent="."]
position = Vector2(0, -7.10543e-15)
shape = SubResource("CircleShape2D_803qd")
[connection signal="body_entered" from="." to="." method="OnBodyEntered"]

View File

@@ -1,15 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://s0dbttuctm8"]
[ext_resource type="Script" uid="uid://b8ppwhc4hl0uk" path="res://Gameplay/Cog.cs" id="1_tsf7f"]
[ext_resource type="PackedScene" uid="uid://c8n4lue2bn25n" path="res://Gameplay/marble.tscn" id="2_unqi5"]
[node name="Cog" type="Node2D"]
script = ExtResource("1_tsf7f")
[node name="Marble" parent="." instance=ExtResource("2_unqi5")]
[node name="Picture" type="Sprite2D" parent="."]
visible = false
[connection signal="BumpMarble" from="Marble" to="." method="Attack"]
[connection signal="DefenseDown" from="Marble" to="." method="HealthChange"]

View File

@@ -1,141 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://cw2ypbamocty5"]
[ext_resource type="Texture2D" uid="uid://dy4lmwn1dit26" path="res://art/shade.png" id="1_coxn2"]
[node name="CogHud" type="CanvasLayer"]
[node name="Background" type="Sprite2D" parent="."]
position = Vector2(98, -128)
scale = Vector2(0.765625, 1)
texture = ExtResource("1_coxn2")
[node name="CogName" type="RichTextLabel" parent="Background"]
offset_left = -111.02
offset_top = -112.0
offset_right = 99.9796
offset_bottom = -89.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Cog Name"
vertical_alignment = 1
[node name="Sprite2D" type="Sprite2D" parent="Background"]
position = Vector2(-7.62939e-06, -31)
scale = Vector2(0.428571, 0.328125)
texture = ExtResource("1_coxn2")
[node name="HealthLabel" type="RichTextLabel" parent="Background"]
offset_left = -111.02
offset_top = 23.0
offset_right = -59.0204
offset_bottom = 46.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Health"
vertical_alignment = 1
[node name="EnergyLabel" type="RichTextLabel" parent="Background"]
offset_left = -111.02
offset_top = 53.0
offset_right = -58.0204
offset_bottom = 76.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Energy"
vertical_alignment = 1
[node name="BandwidthLabel" type="RichTextLabel" parent="Background"]
offset_left = -111.02
offset_top = 83.0
offset_right = -27.0204
offset_bottom = 106.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "Bandwidth"
vertical_alignment = 1
[node name="HealthValue" type="RichTextLabel" parent="Background"]
offset_left = 1.30611
offset_top = 23.0
offset_right = 51.3061
offset_bottom = 46.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="Background"]
offset_left = 1.30611
offset_top = 53.0
offset_right = 51.3061
offset_bottom = 76.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="Background"]
offset_left = 1.30611
offset_top = 83.0
offset_right = 51.3061
offset_bottom = 106.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="Background"]
offset_left = 60.0816
offset_top = 23.0
offset_right = 110.082
offset_bottom = 46.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="Background"]
offset_left = 60.0816
offset_top = 53.0
offset_right = 110.082
offset_bottom = 76.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="Background"]
offset_left = 60.0816
offset_top = 83.0
offset_right = 110.082
offset_bottom = 106.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="Background"]
offset_left = 39.1837
offset_top = 23.0
offset_right = 89.1837
offset_bottom = 46.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "/"
horizontal_alignment = 1
vertical_alignment = 1
[node name="EnergyDivider" type="RichTextLabel" parent="Background"]
offset_left = 39.1837
offset_top = 53.0
offset_right = 89.1837
offset_bottom = 76.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "/"
horizontal_alignment = 1
vertical_alignment = 1
[node name="BandwidthDivider" type="RichTextLabel" parent="Background"]
offset_left = 39.1837
offset_top = 83.0
offset_right = 89.1837
offset_bottom = 106.0
theme_override_colors/default_color = Color(0, 0, 0, 1)
text = "/"
horizontal_alignment = 1
vertical_alignment = 1

View File

@@ -1,14 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://yqtgkxjjexag"]
[gd_scene load_steps=2 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://s0dbttuctm8" path="res://Gameplay/cog.tscn" id="2_7rujl"]
[node name="Main" type="Node"]
script = ExtResource("1_0xm2m")
[node name="Player" parent="." instance=ExtResource("2_7rujl")]
[node name="Enemy" parent="." instance=ExtResource("2_7rujl")]
[node name="EnemyStart" type="Marker2D" parent="."]
position = Vector2(837, 295)

6
Gameplay/player.tscn Normal file
View File

@@ -0,0 +1,6 @@
[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")

9
Gameplay/shark.tscn Normal file
View File

@@ -0,0 +1,9 @@
[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")]

145
Gameplay/sharkhud.tscn Normal file
View File

@@ -0,0 +1,145 @@
[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

BIN
art/CogIcon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

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

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://clqme77dmqd23"
path="res://.godot/imported/CogIcon.png-74cfd6548c51e7dcd49b0734bba428ea.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/CogIcon.png"
dest_files=["res://.godot/imported/CogIcon.png-74cfd6548c51e7dcd49b0734bba428ea.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/billiarball.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cjqa565njih7d"
path="res://.godot/imported/billiarball.png-01a72da7dad54c01690de129789ed199.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/billiarball.png"
dest_files=["res://.godot/imported/billiarball.png-01a72da7dad54c01690de129789ed199.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

View File

@@ -2,34 +2,49 @@ shader_type canvas_item;
uniform float scroll_x = 0.0;
uniform float scroll_y = 0.0;
uniform float rotation : hint_range(-360.0, 360.0) = 0.0;
uniform float globe_magnitude : hint_range(0.0, 1.0) = 1.0;
vec2 rotate(vec2 uv, vec2 pivot, float angle)
{
mat2 r = mat2(vec2(sin(angle), -cos(angle)),
vec2(cos(angle), sin(angle)));
uv -= pivot;
uv = uv * r;
uv += pivot;
return uv;
}
void fragment()
{
// Original UVs from 0 to 1
vec2 uv = UV;
float rotationRads = (rotation + 90.0) * PI / 180.0;
//uv.x = mod(uv.x + x_scroll, 1.0);
//uv.y = mod(uv.y + y_scroll, 1.0);
// Remaps UV to -1, 1, i.e. centers on the sprite
vec2 centered_uv = uv * 2.0 - 1.0;
centered_uv = rotate(centered_uv, vec2(0), rotationRads);
// Radius r of length of the centered UV
float r = length(centered_uv);
if (r > 1.0)
{
discard; // clips anything past the radius of the circle
}
float z = sqrt(1.0 - r * r);
vec2 sphere_uv = centered_uv / (1.0 + z);
sphere_uv.x = mod(sphere_uv.x + scroll_x, 1.0);
sphere_uv.y = mod(sphere_uv.y + scroll_y, 1.0);
sphere_uv = sphere_uv * 0.5 + 0.5;
vec2 final_uv = mix(uv, sphere_uv, globe_magnitude);
COLOR = texture(TEXTURE, final_uv);
}