From 1a00e03306c86a3c063a857ae8af489ab39bc567 Mon Sep 17 00:00:00 2001 From: Clevertop Date: Sun, 11 Aug 2024 22:19:23 +1000 Subject: [PATCH] barebones menu and credits --- Levels/StartingRoom.tscn | 6 ++- README.md | 11 +++- Scripts/ChronoManager.gd | 10 ++++ Scripts/menu.gd | 31 +++++++++++ menu.tscn | 112 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 Scripts/menu.gd create mode 100644 menu.tscn diff --git a/Levels/StartingRoom.tscn b/Levels/StartingRoom.tscn index c40868a..297b854 100644 --- a/Levels/StartingRoom.tscn +++ b/Levels/StartingRoom.tscn @@ -132,12 +132,12 @@ uv1_triplanar = true texture_filter = 0 [sub_resource type="BoxMesh" id="BoxMesh_s4kja"] -size = Vector3(1, 2, 1) +size = Vector3(1, 2, 1.001) [sub_resource type="BoxShape3D" id="BoxShape3D_jvb5m"] size = Vector3(1, 2, 1) -[node name="ChronoManager" type="Node3D" node_paths=PackedStringArray("gui", "pedstalContainer", "chime_player", "world_env", "player", "player_spawn")] +[node name="ChronoManager" type="Node3D" node_paths=PackedStringArray("gui", "pedstalContainer", "chime_player", "world_env", "player", "player_spawn", "left_door", "right_door")] script = ExtResource("1_5b2rd") pedestal_off_mat = ExtResource("2_0aj3l") pedestal_on_mat = ExtResource("3_mnhg8") @@ -147,6 +147,8 @@ chime_player = NodePath("AudioStreamPlayer") world_env = NodePath("WorldEnvironment") player = NodePath("Player") player_spawn = NodePath("PlayerStartPos") +left_door = NodePath("DoorLeft") +right_door = NodePath("DoorRight") [node name="Player" parent="." instance=ExtResource("2_hsi55")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.12895, 0) diff --git a/README.md b/README.md index cf49551..e0b7fa8 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,19 @@ Puzzle game made by Tom for the Playmakers August Jam 2024 - [ ] Credits page - [ ] itch.io page - [ ] kill blocks - resets level if player touches them -- [ ] door, starting level button +- [x] door, starting level button +- [ ] Sounds + - [ ] Press button + - [ ] Level lose + - [ ] doors open + - [x] tick chime + - [ ] take/place/drop block + - [ ] per command sounds? ## COMMANDS - [x] Jump - go up! works in the air too -- [ ] Dash - Move in direction you are facing for 0.3s (horizontal only, maybe normalise/magnitude) +- [x] Dash - Move in direction you are facing for 0.3s (horizontal only, maybe normalise/magnitude) - [x] Phase - collider turns off for 1 second (should i make this longer or a toggle perhaps?) - [ ] Toggle gravity - could also be low gravity? - 2-3 more commands would add more content/puzzle potencial diff --git a/Scripts/ChronoManager.gd b/Scripts/ChronoManager.gd index ea64951..91c1e05 100644 --- a/Scripts/ChronoManager.gd +++ b/Scripts/ChronoManager.gd @@ -15,6 +15,7 @@ var room_started : bool = false var current_tick = 0 var failed : bool = false var fail_timer : float = 2 +var door_timer : float = 0 @export_group("Resources") @export var pedestal_off_mat : Material @@ -28,6 +29,8 @@ var pedestals : Array[Pedestal] @export var world_env : WorldEnvironment @export var player : CharacterBody3D @export var player_spawn : Node3D +@export var left_door : Node3D +@export var right_door : Node3D # Called when the node enters the scene tree for the first time. func _ready(): @@ -41,6 +44,12 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): + if(room_started): + door_timer -= delta + #-1.5 open, -0.5 closed + left_door.position.x = -0.5 + clampf(door_timer*4, -0.995,0) + right_door.position.x = 0.5 + clampf(-door_timer*4, 0,0.995) + if Input.is_action_just_pressed("debug_start"): start_room() @@ -131,6 +140,7 @@ func reset_room(): current_tick = 0 failed = false fail_timer = 2 + door_timer = 0 #reset pedestals for i in pedestals.size(): diff --git a/Scripts/menu.gd b/Scripts/menu.gd new file mode 100644 index 0000000..cb2b49b --- /dev/null +++ b/Scripts/menu.gd @@ -0,0 +1,31 @@ +extends Control + +var credits_shown : bool = false + +@export var level_node : Control +@export var credits_node : Control +@export var credits_button : Button + +# 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): + if credits_shown: + credits_node.visible = true + level_node.visible = false + credits_button.text = "Back to Level Select" + else: + credits_node.visible = false + level_node.visible = true + credits_button.text = "Credits" + + +func _on_credits_button_pressed(): + credits_shown = !credits_shown + + +func _on_credits_page_meta_clicked(meta): + OS.shell_open(str(meta)) diff --git a/menu.tscn b/menu.tscn new file mode 100644 index 0000000..6db6a09 --- /dev/null +++ b/menu.tscn @@ -0,0 +1,112 @@ +[gd_scene load_steps=3 format=3 uid="uid://dggn70v8xqwgy"] + +[ext_resource type="Script" path="res://Scripts/menu.gd" id="1_igukb"] + +[sub_resource type="LabelSettings" id="LabelSettings_d2xlr"] +font_size = 56 +font_color = Color(0.631665, 0.267098, 1, 1) +outline_size = 15 +outline_color = Color(1, 0.446282, 0.988369, 1) + +[node name="Menu" type="Control" node_paths=PackedStringArray("level_node", "credits_node", "credits_button")] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_igukb") +level_node = NodePath("MarginContainer/VBoxContainer/PanelContainer/ScrollContainer/VBoxContainer") +credits_node = NodePath("MarginContainer/VBoxContainer/PanelContainer/ScrollContainer/MarginContainer/CreditsPage") +credits_button = NodePath("MarginContainer/VBoxContainer/HBoxContainer/CreditsButton") + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 200 +theme_override_constants/margin_top = 100 +theme_override_constants/margin_right = 200 +theme_override_constants/margin_bottom = 100 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +layout_mode = 2 + +[node name="Title" type="Label" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Chrono Chamber" +label_settings = SubResource("LabelSettings_d2xlr") +horizontal_alignment = 1 + +[node name="Credit" type="Label" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "by Tom Howarth" +horizontal_alignment = 1 + +[node name="PanelContainer" type="PanelContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer/PanelContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/PanelContainer/ScrollContainer"] +visible = false +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Button" type="Button" parent="MarginContainer/VBoxContainer/PanelContainer/ScrollContainer/VBoxContainer"] +layout_mode = 2 +text = "Level 1 - Name" + +[node name="Button2" type="Button" parent="MarginContainer/VBoxContainer/PanelContainer/ScrollContainer/VBoxContainer"] +layout_mode = 2 +text = "Level 1 - Name" + +[node name="Button3" type="Button" parent="MarginContainer/VBoxContainer/PanelContainer/ScrollContainer/VBoxContainer"] +layout_mode = 2 +text = "Level 1 - Name" + +[node name="Button4" type="Button" parent="MarginContainer/VBoxContainer/PanelContainer/ScrollContainer/VBoxContainer"] +layout_mode = 2 +text = "Level 1 - Name" + +[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer/PanelContainer/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 10 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 10 + +[node name="CreditsPage" type="RichTextLabel" parent="MarginContainer/VBoxContainer/PanelContainer/ScrollContainer/MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +bbcode_enabled = true +text = "Programming and Game Design: [url=https://clevertop.dev]Tom Howarth[/url] +Created for the [url=https://itch.io/jam/playmakers-august-game-jam]August 2024 Game Jam[/url] hosted by Playmakers! - Themes: 3D, Puzzle + +Textures: [url=https://opengameart.org/content/dungeon-crawl-32x32-tiles]Dungeon Crawl Stone Soup[/url] +Command Chime Sounds: [url=https://freesound.org/people/radian/sounds/62986/]Chime 0011.wav by radian[/url]" + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="CreditsButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Credits" + +[node name="ExitButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Exit Game" + +[connection signal="meta_clicked" from="MarginContainer/VBoxContainer/PanelContainer/ScrollContainer/MarginContainer/CreditsPage" to="." method="_on_credits_page_meta_clicked"] +[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/CreditsButton" to="." method="_on_credits_button_pressed"]