From bcbf588ed7c176237c68d5197b6a6422172ff481 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sat, 6 Nov 2021 17:43:03 +0200 Subject: [PATCH] Minor changes --- .../network_processors/network_setup.gd | 6 +- .../scripts/ui_element_handlers/game_UI.gd | 2 +- Game/source/assets/sprites/GUI/wall.svg | 51 ++++++++++ .../source/assets/sprites/GUI/wall.svg.import | 34 +++++++ Game/source/scenes/GUI/network_setup.tscn | 94 +++++++++++-------- Game/source/scenes/OVERLAY/elements/wall.tscn | 14 +++ 6 files changed, 158 insertions(+), 43 deletions(-) create mode 100644 Game/source/assets/sprites/GUI/wall.svg create mode 100644 Game/source/assets/sprites/GUI/wall.svg.import create mode 100644 Game/source/scenes/OVERLAY/elements/wall.tscn diff --git a/Game/source/assets/scripts/server_handlers/network_processors/network_setup.gd b/Game/source/assets/scripts/server_handlers/network_processors/network_setup.gd index 310d81e..09b3023 100644 --- a/Game/source/assets/scripts/server_handlers/network_processors/network_setup.gd +++ b/Game/source/assets/scripts/server_handlers/network_processors/network_setup.gd @@ -21,7 +21,8 @@ func _ready() -> void: background_lobby.hide() device_ip_address.hide() text.hide() - + + get_tree().connect("network_peer_connected", self, "_player_connected") get_tree().connect("network_peer_disconnected", self, "_player_disconnected") get_tree().connect("connected_to_server", self, "_connected_to_server") @@ -47,6 +48,9 @@ func _ready() -> void: func _process(_delta: float) -> void: + if Input.is_action_just_pressed("esc") and username.is_visible_in_tree(): + username.hide() + if get_tree().network_peer != null: if get_tree().get_network_connected_peers().size() >= 0 and get_tree().is_network_server(): start_game.show() diff --git a/Game/source/assets/scripts/ui_element_handlers/game_UI.gd b/Game/source/assets/scripts/ui_element_handlers/game_UI.gd index 279f5a9..f2e07d4 100644 --- a/Game/source/assets/scripts/ui_element_handlers/game_UI.gd +++ b/Game/source/assets/scripts/ui_element_handlers/game_UI.gd @@ -1,7 +1,7 @@ extends CanvasLayer # if 0, then singleplayer will work, if 1, then multiplayer only -var winner_amount = 0 +var winner_amount = 1 onready var win_timer = $Control/winner/win_timer onready var winner = $Control/winner diff --git a/Game/source/assets/sprites/GUI/wall.svg b/Game/source/assets/sprites/GUI/wall.svg new file mode 100644 index 0000000..fff7e58 --- /dev/null +++ b/Game/source/assets/sprites/GUI/wall.svg @@ -0,0 +1,51 @@ + + + + + + + + + + diff --git a/Game/source/assets/sprites/GUI/wall.svg.import b/Game/source/assets/sprites/GUI/wall.svg.import new file mode 100644 index 0000000..5418ada --- /dev/null +++ b/Game/source/assets/sprites/GUI/wall.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/wall.svg-29292bb727b6ec2c2e30231c30f7ad35.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://source/assets/sprites/GUI/wall.svg" +dest_files=[ "res://.import/wall.svg-29292bb727b6ec2c2e30231c30f7ad35.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Game/source/scenes/GUI/network_setup.tscn b/Game/source/scenes/GUI/network_setup.tscn index 8adebbc..b720165 100644 --- a/Game/source/scenes/GUI/network_setup.tscn +++ b/Game/source/scenes/GUI/network_setup.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=2] +[gd_scene load_steps=17 format=2] [ext_resource path="res://source/assets/scripts/server_handlers/network_processors/network_setup.gd" type="Script" id=1] [ext_resource path="res://source/fonts/oxygen/Oxygen-Regular.ttf" type="DynamicFontData" id=2] @@ -12,20 +12,21 @@ [ext_resource path="res://source/fonts/oxygen/oxygen_regular.tres" type="DynamicFont" id=10] [ext_resource path="res://source/assets/scripts/ui_element_handlers/UI.gd" type="Script" id=11] [ext_resource path="res://source/assets/sprites/GUI/background_lobby.svg" type="Texture" id=12] +[ext_resource path="res://source/scenes/OVERLAY/elements/wall.tscn" type="PackedScene" id=13] -[sub_resource type="DynamicFont" id=3] +[sub_resource type="DynamicFont" id=1] size = 36 use_mipmaps = true use_filter = true font_data = ExtResource( 2 ) -[sub_resource type="DynamicFont" id=1] +[sub_resource type="DynamicFont" id=2] size = 88 use_mipmaps = true use_filter = true font_data = ExtResource( 3 ) -[sub_resource type="DynamicFont" id=2] +[sub_resource type="DynamicFont" id=3] size = 22 use_mipmaps = true use_filter = true @@ -172,7 +173,7 @@ margin_bottom = 201.885 [node name="Label" type="Label" parent="multiplayer_configure/username/username_text_edit/confirm"] anchor_right = 1.0 anchor_bottom = 1.0 -custom_fonts/font = SubResource( 3 ) +custom_fonts/font = SubResource( 1 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) text = "CONFIRM" align = 1 @@ -191,49 +192,23 @@ __meta__ = { "_edit_lock_": true } +[node name="wall-L" parent="background_lobby/background_lobby" instance=ExtResource( 13 )] +position = Vector2( -960.5, 0 ) + +[node name="wall-R" parent="background_lobby/background_lobby" instance=ExtResource( 13 )] +position = Vector2( 960.5, 0 ) + +[node name="ceiling" parent="background_lobby/background_lobby" instance=ExtResource( 6 )] +position = Vector2( 0, -603 ) + [node name="floor" parent="background_lobby" instance=ExtResource( 6 )] position = Vector2( 960, 1016 ) [node name="UI" type="CanvasLayer" parent="."] +layer = 0 script = ExtResource( 11 ) -[node name="device_ip_address" type="Label" parent="UI"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -319.0 -margin_top = -56.0 -margin_right = 319.0 -margin_bottom = 56.0 -custom_fonts/font = SubResource( 1 ) -custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 ) -align = 1 -valign = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="text" type="Label" parent="UI"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -116.5 -margin_top = 60.0 -margin_right = 116.5 -margin_bottom = 89.0 -custom_fonts/font = SubResource( 2 ) -custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 ) -text = "WAITING FOR PLAYERS" -align = 1 -valign = 1 -__meta__ = { -"_edit_use_anchors_": false -} - [node name="start_game" parent="UI" instance=ExtResource( 9 )] -visible = false anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 @@ -261,6 +236,43 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="device_ip_address" type="Label" parent="UI"] +show_behind_parent = true +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -319.0 +margin_top = -56.0 +margin_right = 319.0 +margin_bottom = 56.0 +custom_fonts/font = SubResource( 2 ) +custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 ) +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="text" type="Label" parent="UI"] +show_behind_parent = true +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -116.5 +margin_top = 60.0 +margin_right = 116.5 +margin_bottom = 89.0 +custom_fonts/font = SubResource( 3 ) +custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 ) +text = "WAITING FOR PLAYERS" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + [node name="spawn_locations" type="Node" parent="."] [node name="1" type="Position2D" parent="spawn_locations"] diff --git a/Game/source/scenes/OVERLAY/elements/wall.tscn b/Game/source/scenes/OVERLAY/elements/wall.tscn new file mode 100644 index 0000000..4bafd5d --- /dev/null +++ b/Game/source/scenes/OVERLAY/elements/wall.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://source/assets/sprites/GUI/wall.svg" type="Texture" id=1] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 0.507812, 540.016 ) + +[node name="wall" type="StaticBody2D"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) + +[node name="wall" type="Sprite" parent="."] +texture = ExtResource( 1 )