diff --git a/Kamer.tscn b/Kamer.tscn index dadde5f..ab3a85f 100644 --- a/Kamer.tscn +++ b/Kamer.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=29 format=3 uid="uid://cm3uix0tqqavw"] +[gd_scene load_steps=30 format=3 uid="uid://cm3uix0tqqavw"] [ext_resource type="PackedScene" uid="uid://d4hqxyxouje7e" path="res://Objects/Meshes/kamer.glb" id="1_50aco"] [ext_resource type="Texture2D" uid="uid://bjok373y2ssb3" path="res://Images/sky.hdr" id="2_2aenl"] @@ -17,6 +17,7 @@ [ext_resource type="AudioStream" uid="uid://cdyategn54nml" path="res://Audio/F#.mp3" id="14_uv1td"] [ext_resource type="AudioStream" uid="uid://wphketv7cs0b" path="res://Audio/D.mp3" id="15_k8hy3"] [ext_resource type="AudioStream" uid="uid://csa4bd0pvp5as" path="res://Audio/pianomuziek.mp3" id="17_1cw2k"] +[ext_resource type="Script" path="res://Scripts/Gui.gd" id="18_80vxw"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xcyqt"] transparency = 1 @@ -255,7 +256,8 @@ theme_override_colors/default_color = Color(0, 0, 0, 1) theme_override_colors/font_selected_color = Color(0, 0, 0, 1) theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) theme_override_font_sizes/normal_font_size = 72 -text = "Thanks for playing" +bbcode_enabled = true +text = "[center]Thanks for playing[/center]" fit_content_height = true [node name="MarginContainer" type="MarginContainer" parent="Einde/Thx" index="1"] @@ -271,4 +273,54 @@ stream = ExtResource("17_1cw2k") volume_db = -6.191 autoplay = true +[node name="Gui" type="CanvasLayer" parent="." index="18"] +script = ExtResource("18_80vxw") + +[node name="Control" type="Control" parent="Gui" index="0"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +metadata/_edit_use_anchors_ = true + +[node name="BottleService" type="VFlowContainer" parent="Gui/Control" index="0"] +layout_mode = 1 +anchors_preset = 11 +anchor_left = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -200.0 +grow_horizontal = 0 +grow_vertical = 2 +size_flags_horizontal = 8 +size_flags_vertical = 8 +alignment = 2 + +[node name="Panel" type="Panel" parent="Gui/Control/BottleService" index="0"] +visible = false +custom_minimum_size = Vector2(200, 100) +layout_mode = 2 + +[node name="RichTextLabel" type="RichTextLabel" parent="Gui/Control/BottleService/Panel" index="0"] +custom_minimum_size = Vector2(200, 100) +layout_mode = 2 +offset_top = 4.0 +offset_right = 200.0 +offset_bottom = 104.0 +text = "Je moeder" + +[node name="Button" type="Button" parent="Gui/Control/BottleService/Panel/RichTextLabel" index="1"] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -22.0 +offset_bottom = 31.0 +grow_horizontal = 0 +text = "✕" + [connection signal="input_event" from="FlashLight/FlashLight" to="Player" method="_on_flash_light_input_event"] +[connection signal="child_entered_tree" from="Gui/Control/BottleService" to="Gui" method="_on_bottle_service_child_entered_tree"] diff --git a/Scripts/Gui.gd b/Scripts/Gui.gd new file mode 100644 index 0000000..12b3d63 --- /dev/null +++ b/Scripts/Gui.gd @@ -0,0 +1,36 @@ +extends CanvasLayer + +@onready var bottle_service = $Control/BottleService +var timer = 0 +const clear_time = 5 + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + +func message(msg: String, title: String = ""): + var popup = RichTextLabel.new() + popup.custom_minimum_size = Vector2(200,100) + popup.threaded = true + popup.push_bold() + popup.append_text(title) + popup.pop() + popup.newline() + popup.append_text(msg) + var close = Button.new() + close.text = "✕" + close.size = Vector2(20, 31) + close.position = Vector2(175, 0) + close.pressed.connect(_on_close_pressed.bind(close)) + popup.add_child(close) + bottle_service.add_child(popup) + timer = 0 + +func _process(delta): + timer += delta + +func _on_bottle_service_child_entered_tree(node): + pass # Replace with function body. + +func _on_close_pressed(node): + node.get_parent().queue_free() diff --git a/Scripts/Kamer.gd b/Scripts/Kamer.gd index 9b28b00..4a85666 100644 --- a/Scripts/Kamer.gd +++ b/Scripts/Kamer.gd @@ -2,8 +2,4 @@ extends Node3D # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass + $Gui.message("Use TAB to go into select mode and click on objects to interact.", "Hello world") diff --git a/Scripts/Player.gd b/Scripts/Player.gd index 5a9be3b..0f55508 100644 --- a/Scripts/Player.gd +++ b/Scripts/Player.gd @@ -56,5 +56,6 @@ func _on_flash_light_input_event(camera, event, position, normal, shape_idx): if event is InputEventMouseButton and event.is_action_pressed("interact"): $Pivot/Camera/FlashLight.visible = true has_flashlight = true + $".."/Gui.message("You can toggle the flashlight with right-mouse", "Flashlight") if flashlight: flashlight.visible = false