diff --git a/MB_FYP/assets/icon/ShipBlue.ico b/MB_FYP/assets/icon/ShipBlue.ico new file mode 100644 index 0000000..728a1dd Binary files /dev/null and b/MB_FYP/assets/icon/ShipBlue.ico differ diff --git a/MB_FYP/assets/icon/ShipBlue.png b/MB_FYP/assets/icon/ShipBlue.png new file mode 100644 index 0000000..d2c4fef Binary files /dev/null and b/MB_FYP/assets/icon/ShipBlue.png differ diff --git a/MB_FYP/assets/icon/ShipBlue.png.import b/MB_FYP/assets/icon/ShipBlue.png.import new file mode 100644 index 0000000..70c1fdb --- /dev/null +++ b/MB_FYP/assets/icon/ShipBlue.png.import @@ -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 diff --git a/MB_FYP/export_presets.cfg b/MB_FYP/export_presets.cfg new file mode 100644 index 0000000..77deae2 --- /dev/null +++ b/MB_FYP/export_presets.cfg @@ -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 diff --git a/MB_FYP/project.godot b/MB_FYP/project.godot index 4f8b5fb..49658f1 100644 --- a/MB_FYP/project.godot +++ b/MB_FYP/project.godot @@ -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) diff --git a/MB_FYP/scenes/system/game.tscn b/MB_FYP/scenes/system/game.tscn index 6ce8959..eca12a6 100644 --- a/MB_FYP/scenes/system/game.tscn +++ b/MB_FYP/scenes/system/game.tscn @@ -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"] diff --git a/MB_FYP/scenes/ui/input_menu.tscn b/MB_FYP/scenes/ui/input_menu.tscn index 03d0593..49606f0 100644 --- a/MB_FYP/scenes/ui/input_menu.tscn +++ b/MB_FYP/scenes/ui/input_menu.tscn @@ -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 diff --git a/MB_FYP/scenes/ui/main_menu.tscn b/MB_FYP/scenes/ui/main_menu.tscn index e486da7..c248e9a 100644 --- a/MB_FYP/scenes/ui/main_menu.tscn +++ b/MB_FYP/scenes/ui/main_menu.tscn @@ -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 diff --git a/MB_FYP/scenes/ui/pause_menu.tscn b/MB_FYP/scenes/ui/pause_menu.tscn index ccc7455..74b1685 100644 --- a/MB_FYP/scenes/ui/pause_menu.tscn +++ b/MB_FYP/scenes/ui/pause_menu.tscn @@ -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") diff --git a/MB_FYP/script/entities/Laser.cs b/MB_FYP/script/entities/Laser.cs index 9f881cc..38336fd 100644 --- a/MB_FYP/script/entities/Laser.cs +++ b/MB_FYP/script/entities/Laser.cs @@ -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(); } } diff --git a/MB_FYP/script/entities/ai_fighter.cs b/MB_FYP/script/entities/ai_fighter.cs index c9c3a16..3eacc4d 100644 --- a/MB_FYP/script/entities/ai_fighter.cs +++ b/MB_FYP/script/entities/ai_fighter.cs @@ -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,11 +91,7 @@ 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; } diff --git a/MB_FYP/script/entities/asteroid.cs b/MB_FYP/script/entities/asteroid.cs index 28063fa..098b9ba 100644 --- a/MB_FYP/script/entities/asteroid.cs +++ b/MB_FYP/script/entities/asteroid.cs @@ -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) { diff --git a/MB_FYP/script/entities/player.cs b/MB_FYP/script/entities/player.cs index dccf986..43092e0 100644 --- a/MB_FYP/script/entities/player.cs +++ b/MB_FYP/script/entities/player.cs @@ -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")) { diff --git a/MB_FYP/script/entities/ship.cs b/MB_FYP/script/entities/ship.cs index 8211c7d..c64b71b 100644 --- a/MB_FYP/script/entities/ship.cs +++ b/MB_FYP/script/entities/ship.cs @@ -49,8 +49,6 @@ public partial class ship : CharacterBody2D protected virtual void ShootLaser() { - GD.Print(Name, ": firing laser"); - Laser laser = LaserScene.Instantiate(); 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(); } diff --git a/MB_FYP/script/ui/input_menu.cs b/MB_FYP/script/ui/input_menu.cs index b77dd64..e09ece4 100644 --- a/MB_FYP/script/ui/input_menu.cs +++ b/MB_FYP/script/ui/input_menu.cs @@ -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