This commit is contained in:
Victor Turgeon 2023-06-11 12:57:34 -04:00
commit e929b2500e
8 changed files with 56 additions and 25 deletions

Binary file not shown.

BIN
audio/dot.wav Normal file

Binary file not shown.

BIN
audio/gameover.wav Normal file

Binary file not shown.

BIN
audio/no.wav Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

View File

@ -1,9 +1,9 @@
[gd_scene load_steps=8 format=3 uid="uid://cbs0x36e3ranm"]
[ext_resource type="MeshLibrary" uid="uid://dwo1m72yajrb1" path="res://assets/tilesets/tileset.tres" id="1_l447d"]
[ext_resource type="MeshLibrary" uid="uid://bo7ir5us230sa" path="res://assets/tilesets/tileset.tres" id="1_l447d"]
[ext_resource type="PackedScene" uid="uid://b5gb5paiupum" path="res://player/player.tscn" id="2_ojnju"]
[ext_resource type="PackedScene" uid="uid://2pw0p13lcklv" path="res://buildings/kash_buildings/factory.tscn" id="3_08gdj"]
[ext_resource type="AudioStream" uid="uid://byo1w5vecks0m" path="res://music/jazz.ogg" id="3_brvx4"]
[ext_resource type="AudioStream" uid="uid://bba7tiqty57ek" path="res://music/jazz.ogg" id="3_brvx4"]
[ext_resource type="PackedScene" uid="uid://c2casdi4d2o3j" path="res://shaders/water_plane.tscn" id="3_ga7wg"]
[sub_resource type="Environment" id="Environment_lo4sd"]

View File

@ -12,6 +12,9 @@ public partial class start_game_menu : Control {
private LineEdit _ip;
private Label _error, _lip;
[Export]
private AudioStreamPlayer _sndBtn, _sndState;
private string Error { set { _error.Set("text", value); } }
private string IP_address {
set {
@ -24,12 +27,13 @@ public partial class start_game_menu : Control {
if (value == _currState)
return;
IP_address = "";
//_sndState.Play();
switch (value) {
case _state.START:
Error = "";
_single.Set("visible", true);
_localMulti.Set("visible", true);
_LANMulti.Set("visible", true);
//_localMulti.Set("visible", true);
//_LANMulti.Set("visible", true);
_cancel.Set("visible", false);
_yes.Set("visible", false);
_no.Set("visible", false);
@ -42,8 +46,8 @@ public partial class start_game_menu : Control {
case _state.LAN:
Error = "";
_single.Set("visible", false);
_localMulti.Set("visible", false);
_LANMulti.Set("visible", false);
//_localMulti.Set("visible", false);
//_LANMulti.Set("visible", false);
_cancel.Set("visible", true);
_yes.Set("visible", false);
_no.Set("visible", false);
@ -56,8 +60,8 @@ public partial class start_game_menu : Control {
case _state.QUIT:
Error = "Are you sure you want to quit?";
_single.Set("visible", false);
_localMulti.Set("visible", false);
_LANMulti.Set("visible", false);
//_localMulti.Set("visible", false);
//_LANMulti.Set("visible", false);
_cancel.Set("visible", false);
_yes.Set("visible", true);
_no.Set("visible", true);
@ -70,8 +74,8 @@ public partial class start_game_menu : Control {
case _state.HOST:
Error = "Waiting for peer to join...";
_single.Set("visible", false);
_localMulti.Set("visible", false);
_LANMulti.Set("visible", false);
//_localMulti.Set("visible", false);
//_LANMulti.Set("visible", false);
_cancel.Set("visible", true);
_yes.Set("visible", false);
_no.Set("visible", false);
@ -84,8 +88,8 @@ public partial class start_game_menu : Control {
case _state.JOIN:
Error = "Waiting for server...";
_single.Set("visible", false);
_localMulti.Set("visible", false);
_LANMulti.Set("visible", false);
//_localMulti.Set("visible", false);
//_LANMulti.Set("visible", false);
_cancel.Set("visible", true);
_yes.Set("visible", false);
_no.Set("visible", false);
@ -103,8 +107,8 @@ public partial class start_game_menu : Control {
// Called when the node enters the scene tree for the first time.
public override void _Ready() {
_single = GetNode<Button>(_path + "Btn_Single");
_localMulti = GetNode<Button>(_path + "Btn_LocalMulti");
_LANMulti = GetNode<Button>(_path + "Btn_LANMulti");
//_localMulti = GetNode<Button>(_path + "Btn_LocalMulti");
//_LANMulti = GetNode<Button>(_path + "Btn_LANMulti");
_cancel = GetNode<Button>(_path + "Btn_Cancel");
_quit = GetNode<Button>(_path + "Btn_Quit");
_yes = GetNode<Button>(_path + "Btn_Yes");
@ -114,14 +118,14 @@ public partial class start_game_menu : Control {
_error = GetNode<Label>(_path + "lbl_err");
_ip = GetNode<LineEdit>(_path + "txt_IP");
_lip = GetNode<Label>(_path + "lbl_IP");
_single.Pressed += () => startGame(_gameType.SINGLE);
_localMulti.Pressed += () => startGame(_gameType.LOCAL);
_LANMulti.Pressed += () => State = _state.LAN;
_host.Pressed += () => setupLANMultiGame();
_join.Pressed += () => setupLANMultiGame(false);
_quit.Pressed += () => State = _state.QUIT;
_cancel.Pressed += () => State = _state.START;
_no.Pressed += () => State = _state.START;
_single.Pressed += () => { _sndBtn.Play(); startGame(_gameType.SINGLE);};
//_localMulti.Pressed += () => { _sndBtn.Play(); startGame(_gameType.LOCAL);};
//_LANMulti.Pressed += () => { _sndBtn.Play(); State = _state.LAN;};
_host.Pressed += () => { _sndBtn.Play(); setupLANMultiGame();};
_join.Pressed += () => { _sndBtn.Play(); setupLANMultiGame(false);};
_quit.Pressed += () => { _sndBtn.Play(); State = _state.QUIT;};
_cancel.Pressed += () => { _sndBtn.Play(); State = _state.START;};
_no.Pressed += () => { _sndBtn.Play(); State = _state.START;};
_yes.Pressed += () => GetTree().Quit();
State = _state.START;
}
@ -129,7 +133,10 @@ public partial class start_game_menu : Control {
private void startGame(_gameType type, long id = 0) {
switch (type) {
case _gameType.SINGLE:
var scene = GD.Load<PackedScene>("res://levels/test_level.tscn");
var instance = scene.Instantiate();
GetNode<Node>("/root/").AddChild(instance);
this.QueueFree();
break;
case _gameType.LOCAL:

View File

@ -1,10 +1,19 @@
[gd_scene load_steps=7 format=3 uid="uid://4tym1auav4yv"]
[gd_scene load_steps=10 format=3 uid="uid://4tym1auav4yv"]
[ext_resource type="Script" path="res://menu/start_game_menu.cs" id="1_0k2xm"]
[ext_resource type="Texture2D" uid="uid://b44vs2lwgnh37" path="res://images/mushroom_cloud001.webp" id="2_aky60"]
[ext_resource type="AudioStream" uid="uid://ckg5eypyrhidg" path="res://music/I Feel Grunge (Slow).wav" id="2_yw57x"]
[ext_resource type="AudioStream" uid="uid://c8dcqkmytnyay" path="res://audio/btn.wav" id="4_fx2mk"]
[ext_resource type="AudioStream" uid="uid://dja6tipmq1m8l" path="res://audio/dot.wav" id="5_y8gc7"]
[sub_resource type="LabelSettings" id="LabelSettings_n38oc"]
font_size = 290
font_color = Color(0.815686, 0.819608, 1, 1)
outline_size = 24
outline_color = Color(0.533333, 0, 0.0352941, 1)
shadow_size = 19
shadow_color = Color(0, 0, 0, 0.662745)
shadow_offset = Vector2(20, 20)
[sub_resource type="InputEventKey" id="InputEventKey_x36ok"]
pressed = true
@ -17,7 +26,7 @@ keycode = 4194310
[sub_resource type="Shortcut" id="Shortcut_pweny"]
events = [SubResource("InputEventKey_x36ok"), SubResource("InputEventKey_hjkcu")]
[node name="StartGameMenu" type="Control"]
[node name="StartGameMenu" type="Control" node_paths=PackedStringArray("_sndBtn", "_sndState")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@ -25,6 +34,13 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_0k2xm")
_sndBtn = NodePath("Button")
_sndState = NodePath("State")
[node name="MushroomCloud001" type="Sprite2D" parent="."]
modulate = Color(0.317647, 0.133333, 0.137255, 1)
position = Vector2(942, 482)
texture = ExtResource("2_aky60")
[node name="Lbl_Title" type="Label" parent="."]
layout_mode = 0
@ -46,6 +62,7 @@ text = "Single Player
"
[node name="Btn_LocalMulti" type="Button" parent="."]
visible = false
layout_mode = 0
offset_left = 863.0
offset_top = 672.0
@ -54,6 +71,7 @@ offset_bottom = 703.0
text = "Local Multiplayer"
[node name="Btn_LANMulti" type="Button" parent="."]
visible = false
layout_mode = 0
offset_left = 1097.0
offset_top = 670.0
@ -148,3 +166,9 @@ horizontal_alignment = 1
[node name="Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_yw57x")
autoplay = true
[node name="Button" type="AudioStreamPlayer" parent="."]
stream = ExtResource("4_fx2mk")
[node name="State" type="AudioStreamPlayer" parent="."]
stream = ExtResource("5_y8gc7")