Skip to content

Commit

Permalink
Repositiong UI elements and made them more readable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ra314 committed Aug 10, 2021
1 parent f3dc157 commit 1fc4e34
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
7 changes: 6 additions & 1 deletion Scenes/Levels/Level Components/Player.tscn
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
[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 )

[node name="Label" type="Label" parent="."]
margin_right = 40.0
margin_bottom = 14.0
custom_fonts/font = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
26 changes: 14 additions & 12 deletions Scenes/Levels/Level Main.tscn
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
[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]
[ext_resource path="res://Scenes/Levels/Level Components/Drag_Camera.tscn" type="PackedScene" id=3]
[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 )

[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
Expand All @@ -37,48 +41,46 @@ __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__ = {
"_edit_use_anchors_": false
}

[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__ = {
"_edit_use_anchors_": false
}

[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__ = {
"_edit_use_anchors_": false
}

[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__ = {
"_edit_use_anchors_": false
}

[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
}
Expand Down
5 changes: 1 addition & 4 deletions Scripts/Levels/Level Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 1fc4e34

Please sign in to comment.