From 1fc4e34619c1e6a80d4865b3dac54b3939575c49 Mon Sep 17 00:00:00 2001 From: Rahul Gandharva Date: Wed, 11 Aug 2021 01:28:27 +1000 Subject: [PATCH] Repositiong UI elements and made them more readable. --- Scenes/Levels/Level Components/Player.tscn | 7 +++++- Scenes/Levels/Level Main.tscn | 26 ++++++++++++---------- Scripts/Levels/Level Main.gd | 5 +---- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Scenes/Levels/Level Components/Player.tscn b/Scenes/Levels/Level Components/Player.tscn index 9f543e1..ccd16c9 100644 --- a/Scenes/Levels/Level Components/Player.tscn +++ b/Scenes/Levels/Level Components/Player.tscn @@ -1,6 +1,10 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://Scripts/Levels/Level Components/Player.gd" type="Script" id=1] +[ext_resource path="res://Assets/Montserrat-Regular.ttf" type="DynamicFontData" id=2] + +[sub_resource type="DynamicFont" id=1] +font_data = ExtResource( 2 ) [node name="Player" type="Node2D"] script = ExtResource( 1 ) @@ -8,6 +12,7 @@ script = ExtResource( 1 ) [node name="Label" type="Label" parent="."] margin_right = 40.0 margin_bottom = 14.0 +custom_fonts/font = SubResource( 1 ) __meta__ = { "_edit_use_anchors_": false } diff --git a/Scenes/Levels/Level Main.tscn b/Scenes/Levels/Level Main.tscn index 89444d4..f99dbda 100644 --- a/Scenes/Levels/Level Main.tscn +++ b/Scenes/Levels/Level Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://Assets/Our World.png" type="Texture" id=1] [ext_resource path="res://Scripts/Levels/Level Main.gd" type="Script" id=2] @@ -6,6 +6,10 @@ [ext_resource path="res://Assets/Crucible.png" type="Texture" id=4] [ext_resource path="res://Assets/No Mans Land.png" type="Texture" id=5] [ext_resource path="res://Scenes/Levels/Level Components/Player.tscn" type="PackedScene" id=6] +[ext_resource path="res://Assets/Montserrat-Regular.ttf" type="DynamicFontData" id=7] + +[sub_resource type="DynamicFont" id=1] +font_data = ExtResource( 7 ) [node name="Level 1" type="Node2D"] script = ExtResource( 2 ) @@ -13,10 +17,10 @@ script = ExtResource( 2 ) [node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="Player Red" parent="CanvasLayer" instance=ExtResource( 6 )] -position = Vector2( 1142.62, 34.7058 ) +position = Vector2( 0, 300 ) [node name="Player Blue" parent="CanvasLayer" instance=ExtResource( 6 )] -position = Vector2( 755.299, 31.4596 ) +position = Vector2( 0, 450 ) [node name="End Attack" type="Button" parent="CanvasLayer"] margin_right = 125.0 @@ -37,9 +41,8 @@ __meta__ = { } [node name="Reroll Spawn" type="Button" parent="CanvasLayer"] -margin_left = 114.704 margin_top = 935.147 -margin_right = 239.704 +margin_right = 125.0 margin_bottom = 965.147 text = "Reroll Spawn" __meta__ = { @@ -47,9 +50,8 @@ __meta__ = { } [node name="Start Game" type="Button" parent="CanvasLayer"] -margin_left = 113.677 margin_top = 968.514 -margin_right = 238.677 +margin_right = 125.0 margin_bottom = 998.514 text = "Start Game" __meta__ = { @@ -57,9 +59,8 @@ __meta__ = { } [node name="Play Blue" type="Button" parent="CanvasLayer"] -margin_left = 114.779 margin_top = 842.823 -margin_right = 244.779 +margin_right = 130.0 margin_bottom = 872.823 text = "Host plays as Blue" __meta__ = { @@ -67,9 +68,8 @@ __meta__ = { } [node name="Play Red" type="Button" parent="CanvasLayer"] -margin_left = 116.211 margin_top = 807.023 -margin_right = 241.211 +margin_right = 125.0 margin_bottom = 837.023 text = "Host plays as Red" __meta__ = { @@ -77,8 +77,10 @@ __meta__ = { } [node name="Player and Round Tracker" type="Label" parent="CanvasLayer"] +margin_top = 200.0 margin_right = 40.0 -margin_bottom = 14.0 +margin_bottom = 221.0 +custom_fonts/font = SubResource( 1 ) __meta__ = { "_edit_use_anchors_": false } diff --git a/Scripts/Levels/Level Main.gd b/Scripts/Levels/Level Main.gd index 14fb2d0..83341e3 100644 --- a/Scripts/Levels/Level Main.gd +++ b/Scripts/Levels/Level Main.gd @@ -86,9 +86,6 @@ func _ready(): get_node("CanvasLayer/Start Game").queue_free() else: get_node("CanvasLayer/Start Game").connect("button_down", self, "hide_reroll_and_start_butttons") - - # Label keeping track of current player and round number - get_node("CanvasLayer/Player and Round Tracker").set_position(Vector2(get_viewport().size.x/2, 0)) func hide_reroll_and_start_butttons(): remove_reroll_spawn_button() @@ -227,7 +224,7 @@ func end_game(): get_node("CanvasLayer/Player and Round Tracker").text = get_player_with_most_troops().color + " Wins" func update_labels(): - get_node("CanvasLayer/Player and Round Tracker").text = "Player: " + curr_player.color + "\nRound: " + str(round_number) + get_node("CanvasLayer/Player and Round Tracker").text = "Current Player: " + curr_player.color + "\nRound: " + str(round_number) # Network synchronisation remote func synchronise_country(country_name, num_troops, color):