From e8c299862631f5f7341a9e60453d0070e473c24e Mon Sep 17 00:00:00 2001 From: kevadesu Date: Mon, 26 May 2025 03:06:38 +0200 Subject: [PATCH] new level --- Level_Labyrinth.tscn | 124 ++++++++++++++++++++++++++++++ assets/icons/extension.svg | 1 + assets/icons/extension.svg.import | 37 +++++++++ level_list.gd | 3 + main.gd | 8 +- main_l2.gd | 113 +++++++++++++++++++++++++++ main_l2.gd.uid | 1 + pause_menu.tscn | 2 +- player.gd | 27 ++++--- project.godot | 2 +- start.gd | 1 + start.tscn | 26 ++++--- 12 files changed, 314 insertions(+), 31 deletions(-) create mode 100644 Level_Labyrinth.tscn create mode 100644 assets/icons/extension.svg create mode 100644 assets/icons/extension.svg.import create mode 100644 main_l2.gd create mode 100644 main_l2.gd.uid diff --git a/Level_Labyrinth.tscn b/Level_Labyrinth.tscn new file mode 100644 index 0000000..ea1a20a --- /dev/null +++ b/Level_Labyrinth.tscn @@ -0,0 +1,124 @@ +[gd_scene load_steps=16 format=3 uid="uid://vx8amdj4s586"] + +[ext_resource type="Script" uid="uid://cb2ob5t0phqot" path="res://main_l2.gd" id="1_4fas2"] +[ext_resource type="PackedScene" uid="uid://bs6yq6gy7k2sb" path="res://player.tscn" id="2_r0elk"] +[ext_resource type="FontFile" uid="uid://csg0b0d5pmx2m" path="res://InstrumentSerif-Italic.ttf" id="3_nngep"] +[ext_resource type="FontFile" uid="uid://dsgbhej3kmxkm" path="res://InstrumentSans-Italic-VariableFont_wdth,wght.ttf" id="4_758px"] +[ext_resource type="PackedScene" uid="uid://daoyebc0vm7sd" path="res://pause_menu.tscn" id="5_mnf3s"] +[ext_resource type="Texture2D" uid="uid://d15530ei26qvv" path="res://addons/kenney_prototype_textures/purple/texture_02.png" id="6_3xop5"] +[ext_resource type="Shape3D" uid="uid://ck3ryefc358gp" path="res://wall_ncwt.tres" id="7_tb2wo"] + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_rv2mx"] +sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1) +ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1) + +[sub_resource type="Sky" id="Sky_lsi31"] +sky_material = SubResource("ProceduralSkyMaterial_rv2mx") + +[sub_resource type="Environment" id="Environment_fq2vn"] +background_mode = 1 +background_color = Color(0.592153, 0.439631, 0.851984, 1) +sky = SubResource("Sky_lsi31") +tonemap_mode = 2 +glow_enabled = true + +[sub_resource type="LabelSettings" id="LabelSettings_qbfpe"] +font = ExtResource("3_nngep") +font_size = 75 +font_color = Color(0.941176, 0.788235, 0.996078, 1) +outline_size = 10 +outline_color = Color(0, 0, 0, 1) +shadow_size = 16 +shadow_color = Color(0.180005, 0.180005, 0.180005, 0.647059) + +[sub_resource type="LabelSettings" id="LabelSettings_27422"] +font = ExtResource("4_758px") +font_size = 22 +outline_size = 4 +outline_color = Color(0, 0, 0, 1) + +[sub_resource type="LabelSettings" id="LabelSettings_2uy0w"] +font = ExtResource("4_758px") +font_size = 38 +outline_size = 4 +outline_color = Color(0, 0, 0, 1) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qyexb"] +albedo_texture = ExtResource("6_3xop5") + +[sub_resource type="PlaneMesh" id="PlaneMesh_ulki5"] +size = Vector2(10, 10) + +[node name="LevelCore" type="Node3D"] +script = ExtResource("1_4fas2") + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_fq2vn") + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0) +shadow_enabled = true + +[node name="Player" parent="." instance=ExtResource("2_r0elk")] +unique_name_in_owner = true +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0) +top_level = true +linear_damp = 3.0 + +[node name="HUD" type="MarginContainer" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 50 +theme_override_constants/margin_top = 50 +theme_override_constants/margin_right = 50 +theme_override_constants/margin_bottom = 50 + +[node name="HBoxContainer" type="HBoxContainer" parent="HUD"] +layout_mode = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="HUD/HBoxContainer"] +layout_mode = 2 + +[node name="Label_Station" type="Label" parent="HUD/HBoxContainer/VBoxContainer"] +layout_mode = 2 +text = "ERROR LOADING" +label_settings = SubResource("LabelSettings_qbfpe") + +[node name="Label_Controls" type="Label" parent="HUD/HBoxContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 1 +text = "esc - pause +shift+r - back to checkpoint +f5 - restart level" +label_settings = SubResource("LabelSettings_27422") + +[node name="Label_Controls2" type="Label" parent="HUD/HBoxContainer/VBoxContainer"] +layout_mode = 2 +text = "if you see this, the game failed to load the code correctly. +in this case, please restart the game" +label_settings = SubResource("LabelSettings_27422") + +[node name="HBoxContainer2" type="HBoxContainer" parent="HUD"] +layout_mode = 2 + +[node name="Label_Health" type="Label" parent="HUD/HBoxContainer2"] +layout_mode = 2 +size_flags_vertical = 8 +text = "[||||||||||]" +label_settings = SubResource("LabelSettings_2uy0w") +vertical_alignment = 2 + +[node name="PauseMenu" parent="." instance=ExtResource("5_mnf3s")] +visible = false + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +material_override = SubResource("StandardMaterial3D_qyexb") +mesh = SubResource("PlaneMesh_ulki5") + +[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"] +shape = ExtResource("7_tb2wo") diff --git a/assets/icons/extension.svg b/assets/icons/extension.svg new file mode 100644 index 0000000..86d663d --- /dev/null +++ b/assets/icons/extension.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/extension.svg.import b/assets/icons/extension.svg.import new file mode 100644 index 0000000..6fc054d --- /dev/null +++ b/assets/icons/extension.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://brso5ro5k1tri" +path="res://.godot/imported/extension.svg-17fdfaa0398c3dc0122f66da9049a8a9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/icons/extension.svg" +dest_files=["res://.godot/imported/extension.svg-17fdfaa0398c3dc0122f66da9049a8a9.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/level_list.gd b/level_list.gd index 989c560..be5132a 100644 --- a/level_list.gd +++ b/level_list.gd @@ -2,6 +2,9 @@ extends VBoxContainer func _ready() -> void: $bLEVEL1.pressed.connect(_LEVEL1) + $bLEVEL2.pressed.connect(_LEVEL2) func _LEVEL1(): get_tree().change_scene_to_file("res://Level_Core.tscn") +func _LEVEL2(): + get_tree().change_scene_to_file("res://Level_Labyrinth.tscn") diff --git a/main.gd b/main.gd index 4581717..3c7016d 100644 --- a/main.gd +++ b/main.gd @@ -1,6 +1,7 @@ # Do not change those values extends Node3D +#region DO NOT CHANGE var paused = false @onready var pause_menu = $PauseMenu var checkpoint = checkpoint0 @@ -10,6 +11,7 @@ var checkpoint = checkpoint0 var time_accum = 0.0 # Timer accumulator var elapsed_time := 0.0 var restart_count = 0 +#endregion var checkpoint0 = Vector3(0, 2, 1.374) var checkpoint1 = Vector3(-27.5, 13, 12.5) @@ -17,9 +19,11 @@ var checkpoint2 = Vector3(0, 22, 1.374) var checkpoint3 = Vector3(-50, 25, -5) var terminus = Vector3(-8, -8.5, 9.5) +#region DO NOT TOUCH func _ready() -> void: # var player = get_node("%Player") checkpointtext.text = "station 0" +# checkpointtext.text = startmenu.stringing # while true: # wait(5) # print(player.checkpoint) @@ -42,7 +46,6 @@ func _process(delta: float): Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) pauseMenu() elif Input.is_action_just_pressed("proluz_ui_respawn"): - var player = get_node("Player") player.teleport_to_checkpoint() player.health = 100 Engine.time_scale = 1 @@ -51,7 +54,6 @@ func _process(delta: float): restart_count = restart_count + 1 elif Input.is_action_just_pressed("proluz_ui_reset"): get_tree().reload_current_scene() - var player = get_node("Player") $HUD/HBoxContainer/VBoxContainer/Label_Controls2.text = get_formatted_time() # Health bar if player.health == 100: @@ -91,7 +93,7 @@ func _process(delta: float): healthtext.text = "[··········][DEAD/Shift+R to revive]" healthtext.add_theme_color_override("font_color", Color.MEDIUM_PURPLE) Engine.time_scale = 0.001 - +#endregion func get_formatted_time() -> String: var total_milliseconds = int(elapsed_time * 1000) diff --git a/main_l2.gd b/main_l2.gd new file mode 100644 index 0000000..dce7ce9 --- /dev/null +++ b/main_l2.gd @@ -0,0 +1,113 @@ +# Do not change those values +extends Node3D + +var paused = false +@onready var pause_menu = $PauseMenu +var checkpoint = checkpoint0 +@onready var healthtext = $HUD/HBoxContainer2/Label_Health +@onready var checkpointtext = $HUD/HBoxContainer/VBoxContainer/Label_Station +@onready var player = get_node("Player") +var time_accum = 0.0 # Timer accumulator +var elapsed_time := 0.0 +var restart_count = 0 + +var checkpoint0 = Vector3(0, 1.5, 0) +var checkpoint1 = Vector3(-27.5, 13, 12.5) +var checkpoint2 = Vector3(0, 22, 1.374) +var checkpoint3 = Vector3(-50, 25, -5) +var terminus = Vector3(-8, -8.5, 9.5) + +func _ready() -> void: +# var player = get_node("%Player") + checkpointtext.text = "station 0" +# while true: +# wait(5) +# print(player.checkpoint) + + +# DEBUG SECTION: Testing whether checkpoint value is accessible by printing it every 4 seconds +#func _process(delta: float) -> void: +# var player = get_node("Player") +# time_accum += delta +# if time_accum >= 4.0: +# print("Checkpoint:", player.checkpoint) +# time_accum = 0.0 + +func wait(seconds: float) -> void: + await get_tree().create_timer(seconds).timeout + +func _process(delta: float): + elapsed_time += delta + if Input.is_action_just_pressed("ui_cancel"): + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + pauseMenu() + elif Input.is_action_just_pressed("proluz_ui_respawn"): + var player = get_node("Player") + player.teleport_to_checkpoint() + player.health = 100 + Engine.time_scale = 1 + player.audioplayer.stream = load("res://assets/audio/Revive.wav") + player.audioplayer.play() + restart_count = restart_count + 1 + elif Input.is_action_just_pressed("proluz_ui_reset"): + get_tree().reload_current_scene() + var player = get_node("Player") + $HUD/HBoxContainer/VBoxContainer/Label_Controls2.text = get_formatted_time() + # Health bar + if player.health == 100: + healthtext.text = "[//////////]" + healthtext.add_theme_color_override("font_color", Color.GREEN) + elif player.health >= 90: + healthtext.text = "[/////////·]" + healthtext.add_theme_color_override("font_color", Color.GREEN) + elif player.health >= 80: + healthtext.text = "[////////··]" + healthtext.add_theme_color_override("font_color", Color.GREEN) + elif player.health >= 70: + healthtext.text = "[///////···]" + healthtext.add_theme_color_override("font_color", Color.GREEN) + elif player.health >= 60: + healthtext.text = "[//////····]" + healthtext.add_theme_color_override("font_color", Color.GREEN_YELLOW) + elif player.health >= 50: + healthtext.text = "[/////·····]" + healthtext.add_theme_color_override("font_color", Color.GREEN_YELLOW) + elif player.health >= 40: + healthtext.text = "[////······]" + healthtext.add_theme_color_override("font_color", Color.YELLOW) + elif player.health >= 30: + healthtext.text = "[///·······]" + healthtext.add_theme_color_override("font_color", Color.YELLOW) + elif player.health >= 20: + healthtext.text = "[//········]" + healthtext.add_theme_color_override("font_color", Color.YELLOW) + elif player.health >= 10: + healthtext.text = "[/·········]" + healthtext.add_theme_color_override("font_color", Color.INDIAN_RED) + elif player.health >= 1: + healthtext.text = "[|·········][CRITICAL]" + healthtext.add_theme_color_override("font_color", Color.RED) + elif player.health == 0: + healthtext.text = "[··········][DEAD/Shift+R to revive]" + healthtext.add_theme_color_override("font_color", Color.MEDIUM_PURPLE) + Engine.time_scale = 0.001 + + +func get_formatted_time() -> String: + var total_milliseconds = int(elapsed_time * 1000) + var minutes = total_milliseconds / 60000 + var seconds = (total_milliseconds % 60000) / 1000 + var milliseconds = total_milliseconds % 1000 + return "time: %02d:%02d.%03d" % [minutes, seconds, milliseconds] + +func pauseMenu(): + if paused: + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + pause_menu.hide() + Engine.time_scale = 1 + else: + pause_menu.show() + Engine.time_scale = 0.00001 +# Engine.time_scale = -1 + + paused = !paused diff --git a/main_l2.gd.uid b/main_l2.gd.uid new file mode 100644 index 0000000..a4c6461 --- /dev/null +++ b/main_l2.gd.uid @@ -0,0 +1 @@ +uid://cb2ob5t0phqot diff --git a/pause_menu.tscn b/pause_menu.tscn index 00f9f71..c4a78d8 100644 --- a/pause_menu.tscn +++ b/pause_menu.tscn @@ -91,6 +91,6 @@ layout_mode = 2 size_flags_horizontal = 8 size_flags_vertical = 4 -[connection signal="pressed" from="MarginContainer/VBoxContainer/ResumeButton" to="." method="_on_button_pressed"] [connection signal="pressed" from="MarginContainer/VBoxContainer/ResumeButton" to="." method="_on_resume_button_pressed"] +[connection signal="pressed" from="MarginContainer/VBoxContainer/ResumeButton" to="." method="_on_button_pressed"] [connection signal="pressed" from="MarginContainer/VBoxContainer/ExitButton" to="." method="_on_exit_button_pressed"] diff --git a/player.gd b/player.gd index 1cb5369..353a1d4 100644 --- a/player.gd +++ b/player.gd @@ -11,13 +11,16 @@ var pitch_input := 0.0 @onready var audioplayer = get_node("AudioStreamPlayer3D") @onready var twist_pivot := $TwistPivot @onready var pitch_pivot := $TwistPivot/PitchPivot +@onready var currentscene = get_tree().current_scene +#@onready var levelcore = currentscene.get_path() @onready var levelcore = get_node("/root/LevelCore") +#@onready var startmenu = get_node("/root/start/inGameUI") var checkpoint: Vector3 - func _ready() -> void: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) checkpoint = levelcore.checkpoint0 +# checkpoint = levelcore.checkpoint0 # while not get_node_or_null("/Level_Core/LevelCore"): # await get_tree().process_frame # Yield until the next frame # levelcore = get_node("/Level_Core/LevelCore") @@ -45,38 +48,34 @@ func _integrate_forces(state): if collider is StaticBody3D and collider.name == "StaticBody3D_S1": #checkpoint = levelcore.checkpoint1 print("chat we hit the checkpoint one") - levelcore = get_node("/root/LevelCore") - if not levelcore.checkpoint == levelcore.checkpoint1: +# levelcore = get_node("/root/LevelCore") + if not checkpoint == levelcore.checkpoint1: audioplayer.stream = load("res://assets/audio/SceneSpawn.wav") audioplayer.play() - levelcore.checkpoint = levelcore.checkpoint1 + checkpoint = levelcore.checkpoint1 levelcore.checkpointtext.text = "station 1" elif collider is StaticBody3D and collider.name == "StaticBody3D_S2": print("chat we hit the checkpoint two") - levelcore = get_node("/root/LevelCore") - if not levelcore.checkpoint == levelcore.checkpoint2: + if not checkpoint == levelcore.checkpoint2: audioplayer.stream = load("res://assets/audio/SceneSpawn.wav") audioplayer.play() - levelcore.checkpoint = levelcore.checkpoint2 + checkpoint = levelcore.checkpoint2 levelcore.checkpointtext.text = "station 2" elif collider is StaticBody3D and collider.name == "StaticBody3D_S3": - print("chat we hit the checkpoint three") - levelcore = get_node("/root/LevelCore") - if not levelcore.checkpoint == levelcore.checkpoint3: + if not checkpoint == levelcore.checkpoint3: audioplayer.stream = load("res://assets/audio/SceneSpawn.wav") audioplayer.play() - levelcore.checkpoint = levelcore.checkpoint3 + checkpoint = levelcore.checkpoint3 levelcore.checkpointtext.text = "station 3" elif collider is StaticBody3D and collider.name == "StaticBody3D_T": print("chat we hit the end") - levelcore = get_node("/root/LevelCore") - if not levelcore.checkpoint == levelcore.terminus: + if not checkpoint == levelcore.terminus: audioplayer.stream = load("res://assets/audio/WinTada.wav") audioplayer.play() - levelcore.checkpoint = levelcore.terminus + checkpoint = levelcore.terminus levelcore.checkpointtext.text = "terminus" diff --git a/project.godot b/project.godot index 8fb2c4a..478b3c0 100644 --- a/project.godot +++ b/project.godot @@ -17,7 +17,7 @@ config/name_localized={ run/main_scene="res://start.tscn" config/features=PackedStringArray("4.4", "Forward Plus") boot_splash/bg_color=Color(0.14902, 0, 0.258824, 1) -boot_splash/image="uid://doatkgfq3rm5i" +boot_splash/image="uid://i0wvqo27diby" config/icon="uid://fad7xr2jj2nu" [autoload] diff --git a/start.gd b/start.gd index 17b2e0e..3557c07 100644 --- a/start.gd +++ b/start.gd @@ -4,6 +4,7 @@ extends Control @onready var quit_button = get_node("TextureRect/MarginContainer/HBoxContainer/VBoxContainer/QuitButton") @onready var levellist = $TextureRect/MarginContainer/HBoxContainer/LevelList var playbutton = false +var stringing = "hi" func main(): print("Hey!") diff --git a/start.tscn b/start.tscn index b87c4a5..b034b96 100644 --- a/start.tscn +++ b/start.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://bciy4rskxlowb"] +[gd_scene load_steps=14 format=3 uid="uid://bciy4rskxlowb"] [ext_resource type="Script" uid="uid://t2iw8p1c6rq3" path="res://start.gd" id="1_g38d0"] [ext_resource type="Texture2D" uid="uid://cm58nw8150cah" path="res://proluzbg.png" id="2_g38d0"] @@ -7,6 +7,7 @@ [ext_resource type="FontFile" uid="uid://cfk3fgwuhngcw" path="res://InstrumentSans-VariableFont_wdth,wght.ttf" id="5_da165"] [ext_resource type="Script" uid="uid://8qg8pk1kg1hf" path="res://level_list.gd" id="6_g38d0"] [ext_resource type="Texture2D" uid="uid://catqff7wmtny0" path="res://assets/icons/learning.svg" id="7_pob1m"] +[ext_resource type="Texture2D" uid="uid://brso5ro5k1tri" path="res://assets/icons/extension.svg" id="8_gophc"] [ext_resource type="Texture2D" uid="uid://clnhbd4dggxmo" path="res://ProjektLuzidLogo.svg" id="8_pob1m"] [sub_resource type="FontFile" id="FontFile_db7xr"] @@ -126,14 +127,14 @@ layout_mode = 2 [node name="VBoxContainer" type="VBoxContainer" parent="TextureRect/MarginContainer/HBoxContainer"] layout_mode = 2 -size_flags_horizontal = 2 -size_flags_vertical = 4 +size_flags_horizontal = 3 +size_flags_vertical = 0 [node name="TextureRect" type="TextureRect" parent="TextureRect/MarginContainer/HBoxContainer/VBoxContainer"] +custom_minimum_size = Vector2(29, 37) layout_direction = 2 layout_mode = 2 -size_flags_horizontal = 0 -size_flags_vertical = 0 +size_flags_vertical = 4 texture = ExtResource("3_gophc") stretch_mode = 2 @@ -175,13 +176,13 @@ alignment = 0 [node name="LevelList" type="VBoxContainer" parent="TextureRect/MarginContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 +size_flags_vertical = 8 alignment = 1 script = ExtResource("6_g38d0") [node name="Label" type="Label" parent="TextureRect/MarginContainer/HBoxContainer/LevelList"] -visible = false layout_mode = 2 -text = "Notes and bugs:" +text = "Core layer" label_settings = SubResource("LabelSettings_onc8m") horizontal_alignment = 2 @@ -196,20 +197,21 @@ horizontal_alignment = 2 layout_mode = 2 size_flags_vertical = 4 theme_override_fonts/font = ExtResource("5_da165") -text = "Level: Tutorial -Layer: Core" +text = "Tutorial" icon = ExtResource("7_pob1m") alignment = 0 icon_alignment = 2 +expand_icon = true [node name="bLEVEL2" type="Button" parent="TextureRect/MarginContainer/HBoxContainer/LevelList"] -visible = false layout_mode = 2 size_flags_vertical = 4 theme_override_fonts/font = ExtResource("5_da165") -text = "Level: Labyrinth -Layer: Core" +text = "Labyrinth" +icon = ExtResource("8_gophc") alignment = 0 +icon_alignment = 2 +expand_icon = true [node name="bLEVEL3" type="Button" parent="TextureRect/MarginContainer/HBoxContainer/LevelList"] visible = false