diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-09-29 22:31:03 +0100 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-09-29 22:31:03 +0100 |
commit | a10570d865106dcaf1037979cad1788da03e989d (patch) | |
tree | 7f49d98cbeb8f85e32351a428e2d898cc8dcfd2a /prefabs/test_arena.tscn | |
parent | 0b14efee60765701f439b5174e56c0cf0639d20c (diff) |
ui: Add UI to disply ammo and info toasts
Diffstat (limited to 'prefabs/test_arena.tscn')
-rw-r--r-- | prefabs/test_arena.tscn | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/prefabs/test_arena.tscn b/prefabs/test_arena.tscn index c84ae4b..f75e038 100644 --- a/prefabs/test_arena.tscn +++ b/prefabs/test_arena.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=10 format=3 uid="uid://dlevowk0jrhlg"] +[gd_scene load_steps=11 format=3 uid="uid://dlevowk0jrhlg"] [ext_resource type="Script" path="res://scripts/dungeon_manager.gd" id="1_dbsm0"] [ext_resource type="PackedScene" uid="uid://cc1m2a1obsyn4" path="res://addons/fpc/character.tscn" id="1_vc6b5"] [ext_resource type="Script" path="res://scripts/player.gd" id="2_puqns"] +[ext_resource type="Script" path="res://scripts/ui.gd" id="4_mhgxx"] [sub_resource type="Environment" id="Environment_2poci"] background_color = Color(0.130548, 0.170599, 0.433834, 1) @@ -93,10 +94,11 @@ in_air_momentum = false sprint_enabled = false crouch_enabled = false -[node name="PlayerCam" type="Node3D" parent="Player"] +[node name="PlayerCam" type="Node3D" parent="Player" node_paths=PackedStringArray("ui_control")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0) script = ExtResource("2_puqns") grapple_distance = 50.0 +ui_control = NodePath("../../CanvasLayer") [node name="Camera3D" type="Camera3D" parent="Player/PlayerCam"] current = true @@ -120,5 +122,36 @@ shape = SubResource("BoxShape3D_r46wa") [node name="LevelContainer" type="Node3D" parent="."] +[node name="CanvasLayer" type="CanvasLayer" parent="." node_paths=PackedStringArray("player")] +script = ExtResource("4_mhgxx") +player = NodePath("../Player/PlayerCam") + +[node name="Ammo" type="Label" parent="CanvasLayer"] +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -125.0 +offset_top = -71.0 +offset_right = -56.0 +offset_bottom = -48.0 +grow_horizontal = 0 +grow_vertical = 0 +text = "Ammo: 0" + +[node name="Toast" type="Label" parent="CanvasLayer"] +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -20.0 +offset_top = -134.0 +offset_right = 20.0 +offset_bottom = -111.0 +grow_horizontal = 2 +grow_vertical = 0 + [connection signal="area_entered" from="Player/PlayerCam/Area3D" to="Player/PlayerCam" method="_on_interactable_enter"] [connection signal="area_exited" from="Player/PlayerCam/Area3D" to="Player/PlayerCam" method="_on_interactable_exit"] |