-misc: tidied up few bits of code where possible and time allowed

This commit is contained in:
rsxri 2025-04-24 11:30:55 +01:00
parent 83b0eb6ea9
commit d4a03d680b
19 changed files with 261 additions and 97 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dggnstc50lox4"
path="res://.godot/imported/ShipBlue.png-723e15394f2d4b9314849048fef9ccf6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/icon/ShipBlue.png"
dest_files=["res://.godot/imported/ShipBlue.png-723e15394f2d4b9314849048fef9ccf6.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

65
MB_FYP/export_presets.cfg Normal file
View file

@ -0,0 +1,65 @@
[preset.0]
name="Starfighter"
platform="Windows Desktop"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter="config/*.cfg"
exclude_filter=""
export_path="bin/starfighter.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon="res://assets/icon/ShipBlue.ico"
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"
dotnet/include_scripts_content=false
dotnet/include_debug_symbols=true
dotnet/embed_build_outputs=false

View file

@ -11,14 +11,71 @@ config_version=5
[application]
config/name="MB_FYP"
run/main_scene="res://scenes/game.tscn"
config/features=PackedStringArray("4.1", "Forward Plus")
run/main_scene="res://scenes/ui/main_menu.tscn"
config/features=PackedStringArray("4.2", "C#", "Forward Plus")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
[dotnet]
project/assembly_name="MB_FYP"
[input]
up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
]
}
left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
]
}
down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
]
}
right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
]
}
strafe_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
strafe_right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
shoot={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
]
}
reset={
"deadzone": 0.5,
"events": []
}
toggle_fa={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":102,"echo":false,"script":null)
]
}
pause={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
[rendering]
environment/defaults/default_clear_color=Color(0.184314, 0.184314, 0.184314, 1)
environment/defaults/default_clear_color=Color(0, 0, 0, 1)

View file

@ -8118,16 +8118,16 @@ process_mode = 1
position = Vector2(1228, 195)
[node name="Asteroid2" parent="Asteroids" instance=ExtResource("7_xcalb")]
position = Vector2(332, 661)
position = Vector2(1852, 963)
[node name="Asteroid3" parent="Asteroids" instance=ExtResource("7_xcalb")]
position = Vector2(1450, 641)
position = Vector2(-469, 375)
[node name="Asteroid4" parent="Asteroids" instance=ExtResource("7_xcalb")]
position = Vector2(769, 202)
position = Vector2(469, -573)
[node name="Asteroid5" parent="Asteroids" instance=ExtResource("7_xcalb")]
position = Vector2(387, 230)
position = Vector2(433, 922)
[node name="BackgroundTileMap" type="TileMap" parent="."]
position = Vector2(900, 500)
@ -8202,6 +8202,11 @@ position = Vector2(1921, 1512)
[node name="FSpawn3" type="Marker2D" parent="WaveController/Spawns/Friendly"]
position = Vector2(1279, -637)
[connection signal="Exploded" from="Asteroids/Asteroid" to="." method="OnAsteroidExploded"]
[connection signal="Exploded" from="Asteroids/Asteroid2" to="." method="OnAsteroidExploded"]
[connection signal="Exploded" from="Asteroids/Asteroid3" to="." method="OnAsteroidExploded"]
[connection signal="Exploded" from="Asteroids/Asteroid4" to="." method="OnAsteroidExploded"]
[connection signal="Exploded" from="Asteroids/Asteroid5" to="." method="OnAsteroidExploded"]
[connection signal="HealthUpdate" from="WaveController/Ships/Friendly/Player" to="." method="OnPlayerHealthUpdate"]
[connection signal="LaserShot" from="WaveController/Ships/Friendly/Player" to="." method="OnPlayerLaserShot"]
[connection signal="PlayerDeath" from="WaveController/Ships/Friendly/Player" to="." method="OnPlayerDeath"]

View file

@ -48,7 +48,6 @@ text = "Forward"
[node name="InpFwd" type="Button" parent="Layout/Forward"]
layout_mode = 2
text = "W"
[node name="Backward" type="HBoxContainer" parent="Layout"]
layout_mode = 2
@ -60,7 +59,6 @@ text = "Backward"
[node name="InpBack" type="Button" parent="Layout/Backward"]
layout_mode = 2
text = "S"
[node name="Left" type="HBoxContainer" parent="Layout"]
layout_mode = 2
@ -72,7 +70,6 @@ text = "Rotate Left"
[node name="InpLeft" type="Button" parent="Layout/Left"]
layout_mode = 2
text = "A"
[node name="Right" type="HBoxContainer" parent="Layout"]
layout_mode = 2
@ -84,7 +81,6 @@ text = "Rotate Right"
[node name="InpRight" type="Button" parent="Layout/Right"]
layout_mode = 2
text = "D"
[node name="StrafeL" type="HBoxContainer" parent="Layout"]
layout_mode = 2
@ -97,7 +93,6 @@ text = "Strafe Left
[node name="InpSL" type="Button" parent="Layout/StrafeL"]
layout_mode = 2
text = "Left"
[node name="StrafeR" type="HBoxContainer" parent="Layout"]
layout_mode = 2
@ -109,7 +104,6 @@ text = "Strafe Right"
[node name="InpSR" type="Button" parent="Layout/StrafeR"]
layout_mode = 2
text = "Right"
[node name="Shoot" type="HBoxContainer" parent="Layout"]
layout_mode = 2
@ -121,7 +115,6 @@ text = "Shoot"
[node name="InpShoot" type="Button" parent="Layout/Shoot"]
layout_mode = 2
text = "Space"
[node name="Flight Assist" type="HBoxContainer" parent="Layout"]
layout_mode = 2
@ -133,7 +126,6 @@ text = "Flight Assist"
[node name="InpFA" type="Button" parent="Layout/Flight Assist"]
layout_mode = 2
text = "F"
[node name="Pause" type="HBoxContainer" parent="Layout"]
layout_mode = 2
@ -145,7 +137,6 @@ text = "Pause"
[node name="InpPause" type="Button" parent="Layout/Pause"]
layout_mode = 2
text = "P"
[node name="VSeparator3" type="VSeparator" parent="Layout"]
z_index = -1

View file

@ -1,9 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://bh3heupvlc1ok"]
[gd_scene load_steps=7 format=3 uid="uid://bh3heupvlc1ok"]
[ext_resource type="Script" path="res://script/ui/main_menu.cs" id="1_wxwq5"]
[ext_resource type="PackedScene" uid="uid://01tjlnox4crb" path="res://scenes/ui/input_menu.tscn" id="2_2h615"]
[ext_resource type="FontFile" uid="uid://dtpvg4lmre10g" path="res://assets/Fonts/Kenney Future Narrow.ttf" id="2_i5fg3"]
[ext_resource type="PackedScene" uid="uid://fwvsy2g3lj4f" path="res://scenes/ui/ship_choice.tscn" id="3_the1x"]
[sub_resource type="Theme" id="Theme_g7jy6"]
default_font = ExtResource("2_i5fg3")
[sub_resource type="LabelSettings" id="LabelSettings_lgp16"]
font_size = 50
[node name="MainMenu" type="Control"]
layout_mode = 3
anchors_preset = 0
@ -23,32 +30,44 @@ grow_vertical = 2
color = Color(0.143949, 0.135649, 0.124581, 1)
[node name="CenterContainer" type="CenterContainer" parent="CanvasLayer"]
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -48.0
offset_right = 48.0
offset_bottom = 101.0
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Layout" type="VBoxContainer" parent="CanvasLayer/CenterContainer"]
layout_mode = 2
[node name="ExitButton" type="Button" parent="CanvasLayer/CenterContainer/Layout"]
[node name="Label" type="Label" parent="CanvasLayer/CenterContainer/Layout"]
layout_mode = 2
theme = SubResource("Theme_g7jy6")
text = "Starfighter"
label_settings = SubResource("LabelSettings_lgp16")
horizontal_alignment = 1
[node name="VSeparator" type="VSeparator" parent="CanvasLayer/CenterContainer/Layout"]
visibility_layer = 0
custom_minimum_size = Vector2(0, 400)
layout_mode = 2
text = "Exit Game
"
[node name="InputButton" type="Button" parent="CanvasLayer/CenterContainer/Layout"]
visible = false
layout_mode = 2
text = "Inputs
"
[node name="StartButton" type="Button" parent="CanvasLayer/CenterContainer/Layout"]
custom_minimum_size = Vector2(400, 200)
layout_mode = 2
text = "Start Game
"
[node name="ExitButton" type="Button" parent="CanvasLayer/CenterContainer/Layout"]
layout_mode = 2
text = "Exit Game
"
[node name="InputMenu" parent="." instance=ExtResource("2_2h615")]
visible = false
layout_mode = 0

View file

@ -52,6 +52,7 @@ layout_mode = 2
layout_mode = 2
[node name="InputsButton" type="Button" parent="VBox/HBox"]
visible = false
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
theme = SubResource("Theme_siirn")

View file

@ -41,32 +41,27 @@ public partial class Laser : Area2D
ship.ShipFaction.ENEMY => body.Faction is ship.ShipFaction.FRIENDLY or ship.ShipFaction.PLAYER,
ship.ShipFaction.FRIENDLY => body.Faction is ship.ShipFaction.ENEMY or ship.ShipFaction.ACE,
ship.ShipFaction.ACE => body.Faction is ship.ShipFaction.FRIENDLY or ship.ShipFaction.PLAYER,
_ => throw new ArgumentOutOfRangeException() // thank you rider very cool
};
}
private void OnBodyEntered(Node body)
{
GD.Print("Laser hit something: ", body.Name);
if (body is ship target)
{
if (Shooter != null && !ValidTargetFaction(target))
{
GD.Print("friendly fire");
QueueFree();
}
else
{
GD.Print("Hit type: ", body.GetType());
target.ShipDamage(Shooter.Damage);
QueueFree();
}
}
else if (body is StaticBody2D)
else if (body is StaticBody2D) // border detection
{
//GD.Print("laser hit border");
QueueFree();
}
}

View file

@ -59,11 +59,6 @@ public partial class ai_fighter : ship
}
// SETUP
private void SetupAI()
{
return;
}
public void UpdateHealthLabel(int health)
{
_healthLabel.Text = health.ToString();
@ -96,10 +91,6 @@ public partial class ai_fighter : ship
private void HandleFiring(double delta)
{
//GD.Print(Name, ": checking fire");
//GD.Print(Name, ": fireTimer = ", fireTimer);
FireTimer -= (float)delta; // countdown to next shot available
if (FireTimer > 0f) return; // if countdown not finished then no shoot
@ -112,12 +103,8 @@ public partial class ai_fighter : ship
float angleDiff = Mathf.Abs(Mathf.AngleDifference(Rotation, angleToTarget));
float distance = GlobalPosition.DistanceTo(_currentTarget.GlobalPosition);
//GD.Print(Name, ": angleDiff = ", Mathf.RadToDeg(angleDiff));
if (angleDiff < 0.4f && distance <= EngageDistance + 200f) // fire when in range and mostly aligned
{
//GD.Print(Name, ": angleDiff = ", angleDiff, ", distance = ", distance);
ShootLaser();
FireTimer = FireCooldown; // resets cooldown
}
@ -140,7 +127,7 @@ public partial class ai_fighter : ship
}
if (shipParent == null)
{
GD.Print("No shipParent found");
//GD.Print("No shipParent found");
return null;
}

View file

@ -71,8 +71,8 @@ public partial class asteroid : Area2D
public void Explode(ship shooter)
{
//DEBUG PRINT
GD.Print($"DEBUG: Explode() called for {Name} at {GlobalPosition}");
GD.Print($"DEBUG: {Name} calling Explode()");
//GD.Print($"DEBUG: Explode() called for {Name} at {GlobalPosition}");
//GD.Print($"DEBUG: {Name} calling Explode()");
EmitSignal(SignalName.Exploded, GlobalPosition, (int)Size, shooter);
QueueFree();
}
@ -88,8 +88,8 @@ public partial class asteroid : Area2D
if (body is ship ship)
{
ship.ShipDamage((30));
GD.Print(("ship asteroid collide"));
GD.Print(ship.Name, ship.Health);
//GD.Print(("ship asteroid collide"));
//GD.Print(ship.Name, ship.Health);
}
else if (body is StaticBody2D)
{

View file

@ -23,11 +23,6 @@ public partial class player : ship // Inherits from base ship class
private void GetInput()
{
/*LookAt(GetGlobalMousePosition()); //used for mouse-based rotation and movement
Velocity = Transform.X * Input.GetAxis("down", "up") * Speed;
*/
// Movement, could probably move into its own methods instead of GetInput()
RotationDirection = (int)Input.GetAxis("left", "right");
_angularVelocity += RotationDirection * _angularAccel;
_angularVelocity = Mathf.Clamp(_angularVelocity, -RotationSpeed, RotationSpeed);
@ -37,18 +32,15 @@ public partial class player : ship // Inherits from base ship class
_angularVelocity = Mathf.MoveToward(_angularVelocity, 0f, FlightAssistValue);
}
//GD.Print(RotationDirection);
Velocity += (Transform.X * Input.GetAxis("strafe_left", "strafe_right") * StrafeSpeed) + (Transform.Y * Input.GetAxis("up", "down") * MainSpeed);
Velocity = Velocity.LimitLength(MaxSpeed);
//move into selection statement for toggling between fa off and on
if(Input.GetAxis("strafe_left", "strafe_right") == 0){
Velocity = Velocity.MoveToward(Vector2.Zero, FlightAssistValue);
}
else if(Input.GetAxis("down", "up") == 0){
Velocity = Velocity.MoveToward(Vector2.Zero, FlightAssistValue);
}
//FA toggle
if (Input.IsActionJustPressed("toggle_fa"))
{

View file

@ -49,8 +49,6 @@ public partial class ship : CharacterBody2D
protected virtual void ShootLaser()
{
GD.Print(Name, ": firing laser");
Laser laser = LaserScene.Instantiate<Laser>();
laser.Position = LaserSpawn.GlobalPosition + -Transform.Y * 25f;
laser.Shooter = this;
@ -197,7 +195,7 @@ public partial class ship : CharacterBody2D
protected virtual void Explode()
{
GD.Print(Name, " exploded");
//GD.Print(Name, " exploded");
QueueFree();
}

View file

@ -18,6 +18,8 @@ public partial class input_menu : CenterContainer
private Button _inpFA;
private Button _inpPause;
private bool _buttonInit = false;
public override void _Ready()
{
awaitingLabel = GetNode<Label>("Layout/ListenLabel");
@ -46,8 +48,18 @@ public partial class input_menu : CenterContainer
_inpShoot.Pressed += () => StartRebind("shoot", _inpShoot);
_inpFA.Pressed += () => StartRebind("toggle_fa", _inpFA);
_inpPause.Pressed += () => StartRebind("pause", _inpPause);
//LoadInputConfig();
//UpdateButtonText();
}
public override void _Process(double delta)
{
if (Visible && _buttonInit)
{
LoadInputConfig();
UpdateButtonText();
_buttonInit = true;
}
}
private void UpdateButtonText()
@ -133,6 +145,7 @@ public partial class input_menu : CenterContainer
public void ShowInputPanel()
{
this.Visible = true;
UpdateButtonText();
}
public void HideInputPanel()

View file

@ -10,6 +10,24 @@ public partial class main_menu : Control
public override void _Ready()
{
//input file handling
//GD.Print(FileAccess.FileExists("user://config/input.cfg"));
if (!FileAccess.FileExists("user://config/input.cfg"))
{
//GD.Print("No user input.cfg found — copying default config.");
var src = FileAccess.Open("res://config/input.cfg", FileAccess.ModeFlags.Read);
var dst = FileAccess.Open("user://config/input.cfg", FileAccess.ModeFlags.Write);
//GD.Print("Contents of default input.cfg:\n", src.GetAsText());
dst.StoreString(src.GetAsText());
src.Close();
dst.Close();
}
_inputMenu = GetNode<input_menu>("InputMenu");
_shipChoice = GetNode<ship_choice>("ShipChoice");
_layout = GetNode<VBoxContainer>("CanvasLayer/CenterContainer/Layout");
@ -34,7 +52,7 @@ public partial class main_menu : Control
private void OnInputButtonPressed()
{
_inputMenu.Show();
_inputMenu.ShowInputPanel();
}
// Called every frame. 'delta' has been the elapsed time since the previous frame.

View file

@ -24,7 +24,7 @@ public partial class pause_menu : CenterContainer
_inputButton.Pressed += () =>
{
_inputMenu.Visible = true;
_inputMenu.ShowInputPanel();
};
_quitButton.Pressed += () =>

View file

@ -18,13 +18,6 @@ public partial class upgrade_menu : CenterContainer
[Export]
public player PlayerNode;
private int _playerBaseHealth;
private int _playerBaseDamage;
private int _playerBaseMaxSpeed;
private int _playerBaseMainSpeed;
private int _playerBaseStrafeSpeed;
private float _playerBaseRotationSpeed;
public override void _Ready()
{
_healthUpgrade = GetNode<Button>("VBox/HBox/Health/HealthUpgrade");
@ -35,19 +28,13 @@ public partial class upgrade_menu : CenterContainer
_speedStat = GetNode<Label>("VBox/HBox/Speed/SpeedStat");
_damageStat = GetNode<Label>("VBox/HBox/Damage/DamageStat");
_playerBaseHealth = PlayerNode.MaxHealth;
_playerBaseDamage = PlayerNode.Damage;
_playerBaseMaxSpeed = PlayerNode.MaxSpeed;
_playerBaseMainSpeed = PlayerNode.MainSpeed;
_playerBaseStrafeSpeed = PlayerNode.StrafeSpeed;
_playerBaseRotationSpeed = PlayerNode.RotationSpeed;
_healthUpgrade.Pressed += () =>
{
_healthInt += 10;
_healthStat.Text = ("+ " + _healthInt + "%");
GetTree().Paused = false;
PlayerNode.HealthUpgrade();
if (_healthInt <= 100) PlayerNode.HealthUpgrade();
Visible = false;
};
@ -56,7 +43,7 @@ public partial class upgrade_menu : CenterContainer
_speedInt += 10;
_speedStat.Text = ("+ " + _speedInt + "%");
GetTree().Paused = false;
PlayerNode.SpeedUpgrade();
if (_speedInt <= 100) PlayerNode.SpeedUpgrade();
Visible = false;
};
@ -65,7 +52,7 @@ public partial class upgrade_menu : CenterContainer
_damageInt += 10;
_damageStat.Text = ("+ " + _damageInt + "%");
GetTree().Paused = false;
PlayerNode.DamageUpgrade();
if (_speedInt <= 100) PlayerNode.DamageUpgrade();
Visible = false;
};
}

View file

@ -57,15 +57,17 @@ public partial class wavecontroller : Node2D
}
// spawn friendlies after 5 waves & if 1 or less remaining
// also trigger upgrade menu at the start of the wave (but not first wave)
if ((CurrWave - 1) % 5 == 0 && _friendlyNode.GetChildCount() <= 1)
if ((CurrWave - 1) % 5 == 0)
{
if (CurrWave != 1)
{
UpgradeMenu.Show();
GetTree().Paused = true;
}
//GD.Print("attempting to spawn friendlies");
if (_friendlyNode.GetChildCount() <= 1)
{
foreach (var spawn in _friendlySpawns)
{
Random rand = new Random();
@ -80,6 +82,7 @@ public partial class wavecontroller : Node2D
_friendlyNode.AddChild(friendly);
}
}
}
else if (CurrWave % 5 == 0) // ace/boss wave
{
@ -104,7 +107,6 @@ public partial class wavecontroller : Node2D
_aiStatModifier += 0.1f; // increase ai stat modifier by 0.1f after an ace wave
if (_aiStatModifier >= 2f) _aiStatModifier = 2f; // cap ai stat modifier at 2f (10 ace waves)
}
}