From bc73f5f075540c2f60b3ec2e216a3ecda85fdfc3 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sat, 1 Aug 2020 15:51:18 +0300 Subject: Add GUI --- scenes/GUI.tscn | 22 ++++++++++++++++++++++ scenes/Scene1.tscn | 9 +++++++-- scenes/Scene2.tscn | 13 ++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 scenes/GUI.tscn (limited to 'scenes') diff --git a/scenes/GUI.tscn b/scenes/GUI.tscn new file mode 100644 index 0000000..8a328c8 --- /dev/null +++ b/scenes/GUI.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://scripts/GUI.gd" type="Script" id=1] + +[node name="GUI" type="MarginContainer"] +anchor_right = 1.0 +margin_left = 20.0 +margin_top = 20.0 +margin_right = -20.0 +margin_bottom = -20.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +margin_right = 984.0 +margin_bottom = 14.0 + +[node name="Label" type="Label" parent="VBoxContainer"] +margin_right = 984.0 +margin_bottom = 14.0 diff --git a/scenes/Scene1.tscn b/scenes/Scene1.tscn index 2656dbd..d6652d9 100644 --- a/scenes/Scene1.tscn +++ b/scenes/Scene1.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=52 format=2] +[gd_scene load_steps=53 format=2] [ext_resource path="res://scenes/PlayerCharacter.tscn" type="PackedScene" id=1] [ext_resource path="res://textures/world_tileset.tres" type="Texture" id=2] @@ -6,6 +6,7 @@ [ext_resource path="res://scripts/Scene1.gd" type="Script" id=4] [ext_resource path="res://externals/point_light.png" type="Texture" id=5] [ext_resource path="res://scenes/Ladder.tscn" type="PackedScene" id=6] +[ext_resource path="res://scenes/GUI.tscn" type="PackedScene" id=7] [sub_resource type="OccluderPolygon2D" id=1] polygon = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) @@ -311,12 +312,12 @@ tile_data = PoolIntArray( -262152, 0, 0, -262151, 0, 0, -262150, 0, 0, -262149, [node name="PlayerCharacter" parent="YSort" instance=ExtResource( 1 )] position = Vector2( 12.8563, 19.5552 ) speed = 32 +gui_node = NodePath("../../CanvasLayer/GUI") [node name="Camera2D" type="Camera2D" parent="YSort/PlayerCharacter"] current = true zoom = Vector2( 0.2, 0.2 ) process_mode = 0 -smoothing_enabled = true smoothing_speed = 2.0 [node name="Light2D" type="Light2D" parent="YSort/PlayerCharacter"] @@ -338,3 +339,7 @@ target = NodePath("../PlayerCharacter") [node name="Ladder" parent="YSort" instance=ExtResource( 6 )] target_scene_num = 2 + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="GUI" parent="CanvasLayer" instance=ExtResource( 7 )] diff --git a/scenes/Scene2.tscn b/scenes/Scene2.tscn index 4888419..a19590b 100644 --- a/scenes/Scene2.tscn +++ b/scenes/Scene2.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=52 format=2] +[gd_scene load_steps=53 format=2] [ext_resource path="res://scenes/PlayerCharacter.tscn" type="PackedScene" id=1] [ext_resource path="res://textures/world_tileset.tres" type="Texture" id=2] @@ -6,6 +6,7 @@ [ext_resource path="res://scripts/Scene1.gd" type="Script" id=4] [ext_resource path="res://externals/point_light.png" type="Texture" id=5] [ext_resource path="res://scenes/Ladder.tscn" type="PackedScene" id=6] +[ext_resource path="res://scripts/GUI.gd" type="Script" id=7] [sub_resource type="OccluderPolygon2D" id=1] polygon = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) @@ -339,3 +340,13 @@ target = NodePath("../../../Scene2/YSort/PlayerCharacter") [node name="Ladder" parent="YSort" instance=ExtResource( 6 )] position = Vector2( 88, 48 ) target_scene_num = 1 + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="GUI" type="MarginContainer" parent="CanvasLayer"] +margin_right = 40.0 +margin_bottom = 40.0 +script = ExtResource( 7 ) +__meta__ = { +"_edit_use_anchors_": false +} -- cgit v1.3