diff --git a/MB_FYP/scenes/ai_fighter.tscn b/MB_FYP/scenes/ai_fighter.tscn index 05f50fa..86079d7 100644 --- a/MB_FYP/scenes/ai_fighter.tscn +++ b/MB_FYP/scenes/ai_fighter.tscn @@ -18,13 +18,14 @@ script = ExtResource("1_kyds1") Faction = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] +scale = Vector2(1.3, 1.3) shape = SubResource("CircleShape2D_6vq6f") [node name="ShipSprite" type="Sprite2D" parent="."] texture = ExtResource("1_4l75b") [node name="LaserSpawn" type="Node2D" parent="."] -position = Vector2(0, -58) +position = Vector2(0, -75) [node name="EffectSpawn" type="Node2D" parent="."] diff --git a/MB_FYP/scenes/input_menu.tscn b/MB_FYP/scenes/input_menu.tscn index db90319..c3f810e 100644 --- a/MB_FYP/scenes/input_menu.tscn +++ b/MB_FYP/scenes/input_menu.tscn @@ -1,93 +1,174 @@ -[gd_scene format=3 uid="uid://01tjlnox4crb"] +[gd_scene load_steps=2 format=3 uid="uid://01tjlnox4crb"] -[node name="InputMenu" type="Control"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = 13.0 -offset_top = 13.0 -offset_right = 7.0 -offset_bottom = 3.0 +[ext_resource type="Script" path="res://script/input_menu.cs" id="1_u13wa"] + +[node name="InputMenu" type="CenterContainer"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -200.0 +offset_top = -250.0 +offset_right = 200.0 +offset_bottom = 250.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_u13wa") -[node name="VBoxContainer" type="VBoxContainer" parent="."] +[node name="ColorRect" type="ColorRect" parent="."] +custom_minimum_size = Vector2(400, 500) layout_mode = 2 -offset_right = 351.0 -offset_bottom = 566.0 +color = Color(0.233203, 0.22148, 0.205431, 1) -[node name="Forward" type="HBoxContainer" parent="VBoxContainer"] +[node name="Layout" type="VBoxContainer" parent="."] +custom_minimum_size = Vector2(400, 500) +layout_mode = 2 +alignment = 1 + +[node name="Label" type="Label" parent="Layout"] +z_index = 1 +layout_mode = 2 +text = "Inputs" +horizontal_alignment = 1 +uppercase = true + +[node name="VSeparator" type="VSeparator" parent="Layout"] +z_index = -1 +custom_minimum_size = Vector2(400, 35) layout_mode = 2 -[node name="InpFwdLabel" type="Label" parent="VBoxContainer/Forward"] +[node name="Forward" type="HBoxContainer" parent="Layout"] +layout_mode = 2 +alignment = 1 + +[node name="InpFwdLabel" type="Label" parent="Layout/Forward"] layout_mode = 2 text = "Forward" -[node name="InpFwd" type="Button" parent="VBoxContainer/Forward"] +[node name="InpFwd" type="Button" parent="Layout/Forward"] layout_mode = 2 text = "W" -[node name="Backward" type="HBoxContainer" parent="VBoxContainer"] +[node name="Backward" type="HBoxContainer" parent="Layout"] layout_mode = 2 +alignment = 1 -[node name="InpBckLabel" type="Label" parent="VBoxContainer/Backward"] +[node name="InpBckLabel" type="Label" parent="Layout/Backward"] layout_mode = 2 text = "Backward" -[node name="InpBck" type="Button" parent="VBoxContainer/Backward"] +[node name="InpBack" type="Button" parent="Layout/Backward"] layout_mode = 2 text = "S" -[node name="Left" type="HBoxContainer" parent="VBoxContainer"] +[node name="Left" type="HBoxContainer" parent="Layout"] layout_mode = 2 +alignment = 1 -[node name="InpLftLabel" type="Label" parent="VBoxContainer/Left"] +[node name="InpLftLabel" type="Label" parent="Layout/Left"] layout_mode = 2 -text = "Left" +text = "Rotate Left" -[node name="InpLft" type="Button" parent="VBoxContainer/Left"] +[node name="InpLeft" type="Button" parent="Layout/Left"] layout_mode = 2 text = "A" -[node name="Right" type="HBoxContainer" parent="VBoxContainer"] +[node name="Right" type="HBoxContainer" parent="Layout"] layout_mode = 2 +alignment = 1 -[node name="InpRhtLabel" type="Label" parent="VBoxContainer/Right"] +[node name="InpRhtLabel" type="Label" parent="Layout/Right"] layout_mode = 2 -text = "Right" +text = "Rotate Right" -[node name="InpRht" type="Button" parent="VBoxContainer/Right"] +[node name="InpRight" type="Button" parent="Layout/Right"] layout_mode = 2 text = "D" -[node name="Shoot" type="HBoxContainer" parent="VBoxContainer"] +[node name="StrafeL" type="HBoxContainer" parent="Layout"] layout_mode = 2 +alignment = 1 -[node name="InpShootLabel" type="Label" parent="VBoxContainer/Shoot"] +[node name="InpSLLabel" type="Label" parent="Layout/StrafeL"] +layout_mode = 2 +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 +alignment = 1 + +[node name="InpSRLabel" type="Label" parent="Layout/StrafeR"] +layout_mode = 2 +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 +alignment = 1 + +[node name="InpShootLabel" type="Label" parent="Layout/Shoot"] layout_mode = 2 text = "Shoot" -[node name="InpShoot" type="Button" parent="VBoxContainer/Shoot"] +[node name="InpShoot" type="Button" parent="Layout/Shoot"] layout_mode = 2 -text = "SPACE" +text = "Space" -[node name="Flight Assist" type="HBoxContainer" parent="VBoxContainer"] +[node name="Flight Assist" type="HBoxContainer" parent="Layout"] layout_mode = 2 +alignment = 1 -[node name="InpFALabel" type="Label" parent="VBoxContainer/Flight Assist"] +[node name="InpFALabel" type="Label" parent="Layout/Flight Assist"] layout_mode = 2 text = "Flight Assist" -[node name="InpFA" type="Button" parent="VBoxContainer/Flight Assist"] +[node name="InpFA" type="Button" parent="Layout/Flight Assist"] layout_mode = 2 text = "F" -[node name="Back" type="Button" parent="VBoxContainer"] +[node name="Pause" type="HBoxContainer" parent="Layout"] +layout_mode = 2 +alignment = 1 + +[node name="InpPauseLabel" type="Label" parent="Layout/Pause"] +layout_mode = 2 +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 +custom_minimum_size = Vector2(400, 8) +layout_mode = 2 + +[node name="ListenLabel" type="Label" parent="Layout"] +z_index = 1 +layout_mode = 2 +text = "Listening..." +horizontal_alignment = 1 + +[node name="VSeparator2" type="VSeparator" parent="Layout"] +z_index = -1 +custom_minimum_size = Vector2(400, 8) +layout_mode = 2 + +[node name="Back" type="Button" parent="Layout"] layout_mode = 2 text = "Back " -[node name="Save" type="Button" parent="VBoxContainer"] +[node name="Save" type="Button" parent="Layout"] +visible = false layout_mode = 2 text = "Save" diff --git a/MB_FYP/scenes/main_menu.tscn b/MB_FYP/scenes/main_menu.tscn index 1114447..5f9fad9 100644 --- a/MB_FYP/scenes/main_menu.tscn +++ b/MB_FYP/scenes/main_menu.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=2 format=3 uid="uid://bh3heupvlc1ok"] +[gd_scene load_steps=3 format=3 uid="uid://bh3heupvlc1ok"] [ext_resource type="Script" path="res://script/main_menu.cs" id="1_wxwq5"] +[ext_resource type="PackedScene" uid="uid://01tjlnox4crb" path="res://scenes/input_menu.tscn" id="2_2h615"] [node name="MainMenu" type="Control"] layout_mode = 3 @@ -9,23 +10,37 @@ offset_right = 40.0 offset_bottom = 40.0 script = ExtResource("1_wxwq5") -[node name="StartButton" type="Button" parent="."] +[node name="Layout" type="VBoxContainer" parent="."] layout_mode = 0 -offset_right = 8.0 -offset_bottom = 8.0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="StartButton" type="Button" parent="Layout"] +layout_mode = 2 text = "Start Game " -[node name="ExitButton" type="Button" parent="."] -layout_mode = 1 -anchors_preset = -1 -anchor_left = -1.52 -anchor_top = 0.5 -anchor_right = -1.52 -anchor_bottom = 0.5 -offset_left = 61.8 -offset_top = 13.0 -offset_right = 157.8 -offset_bottom = 44.0 +[node name="InputButton" type="Button" parent="Layout"] +layout_mode = 2 +text = "Inputs +" + +[node name="ExitButton" type="Button" parent="Layout"] +layout_mode = 2 text = "Exit Game " + +[node name="InputMenu" parent="." instance=ExtResource("2_2h615")] +visible = false +layout_mode = 0 +anchors_preset = 0 +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +offset_left = 770.0 +offset_top = 270.0 +offset_right = 1170.0 +offset_bottom = 770.0 +grow_horizontal = 1 +grow_vertical = 1 diff --git a/MB_FYP/script/ai_fighter.cs b/MB_FYP/script/ai_fighter.cs index 2bf5be2..7de7491 100644 --- a/MB_FYP/script/ai_fighter.cs +++ b/MB_FYP/script/ai_fighter.cs @@ -16,6 +16,9 @@ public partial class ai_fighter : ship public bool SignalsConnected { get; set; } = false; + private CollisionShape2D _hitbox; + public float HitboxModifier = 1f; + private Label _healthLabel; private Label _hpLabel; @@ -29,6 +32,9 @@ public partial class ai_fighter : ship public override void _Ready() { + _hitbox = GetNode("CollisionShape2D"); + _hitbox.Scale = new Vector2(HitboxModifier, HitboxModifier); + SetShipStats(); SetupVisual(); Sprite.Texture = GD.Load(SpritePath); diff --git a/MB_FYP/script/input_menu.cs b/MB_FYP/script/input_menu.cs new file mode 100644 index 0000000..b77dd64 --- /dev/null +++ b/MB_FYP/script/input_menu.cs @@ -0,0 +1,175 @@ +using Godot; +using System; + +public partial class input_menu : CenterContainer +{ + //public CenterContainer Menu; + private string awaitingAction; + private Label awaitingLabel; + private Button awaitingButton; + + private Button _inpFwd; + private Button _inpBack; + private Button _inpLeft; + private Button _inpRight; + private Button _inpSR; + private Button _inpSL; + private Button _inpShoot; + private Button _inpFA; + private Button _inpPause; + + public override void _Ready() + { + awaitingLabel = GetNode