Checkpoint-System irgendwie komplett verschissen

This commit is contained in:
kevadesu 2025-05-10 19:25:11 +02:00
parent 52da27c158
commit c2d39d71b2
16 changed files with 154 additions and 35 deletions

1
Level_Core.gd Normal file
View file

@ -0,0 +1 @@
extends Node3D

1
Level_Core.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://cypbow1nrmn5a

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=23 format=3 uid="uid://bn20cqfwvm2oe"]
[gd_scene load_steps=24 format=3 uid="uid://bn20cqfwvm2oe"]
[ext_resource type="Script" uid="uid://wr38f8q1w7yq" path="res://pause_menu.gd" id="1_fwt2i"]
[ext_resource type="Script" uid="uid://wr38f8q1w7yq" path="res://main.gd" id="1_fwt2i"]
[ext_resource type="PackedScene" uid="uid://bs6yq6gy7k2sb" path="res://player.tscn" id="1_lsi31"]
[ext_resource type="Shape3D" uid="uid://30um6cm5oj6q" path="res://wall_cwt.tres" id="2_7sds5"]
[ext_resource type="FontFile" uid="uid://rswq6vrwr2nx" path="res://InstrumentSans-VariableFont_wdth,wght.ttf" id="2_fq2vn"]
@ -30,6 +30,10 @@ albedo_texture = ExtResource("2_gp22r")
[sub_resource type="PlaneMesh" id="PlaneMesh_rv2mx"]
size = Vector2(10, 10)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_33ny2"]
transparency = 1
albedo_color = Color(0.618889, 0.459095, 1, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o66vw"]
albedo_texture = ExtResource("5_r3eyv")
@ -101,10 +105,11 @@ shape = ExtResource("3_n0qnv")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 0.5, -27.5, 10, 12.5)
mesh = SubResource("PlaneMesh_rv2mx")
skeleton = NodePath("../MeshInstance3D")
surface_material_override/0 = SubResource("StandardMaterial3D_33ny2")
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D14"]
[node name="StaticBody3D_S1" type="StaticBody3D" parent="MeshInstance3D14"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D14/StaticBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D14/StaticBody3D_S1"]
shape = ExtResource("3_n0qnv")
[node name="MeshInstance3D25" type="MeshInstance3D" parent="."]
@ -121,12 +126,19 @@ shape = ExtResource("3_n0qnv")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 0.5, -27.5, 10, 7.5)
mesh = SubResource("PlaneMesh_rv2mx")
skeleton = NodePath("../MeshInstance3D")
surface_material_override/0 = SubResource("StandardMaterial3D_33ny2")
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D24"]
[node name="StaticBody3D_S1" type="StaticBody3D" parent="MeshInstance3D24"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D24/StaticBody3D"]
[node name="CollisionShape3D_S1" type="CollisionShape3D" parent="MeshInstance3D24/StaticBody3D_S1"]
shape = ExtResource("3_n0qnv")
[node name="MeshInstance3D49" type="MeshInstance3D" parent="."]
transform = Transform3D(-3.49691e-08, -1, -1.31134e-08, 0, -4.37114e-08, 0.3, -0.8, 4.37114e-08, 5.73206e-16, -30.8179, 12, 10.0294)
mesh = SubResource("PlaneMesh_rv2mx")
skeleton = NodePath("../MeshInstance3D")
surface_material_override/0 = SubResource("StandardMaterial3D_33ny2")
[node name="MeshInstance3D26" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.707107, 0.353553, 0, -0.707107, 0.353553, -12.5, 10, 12.5)
mesh = SubResource("PlaneMesh_rv2mx")
@ -280,7 +292,7 @@ skeleton = NodePath("../MeshInstance3D")
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D48"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D48/StaticBody3D"]
shape = ExtResource("3_n0qnv")
shape = ExtResource("2_7sds5")
[node name="MeshInstance3D6" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, -10)
@ -493,6 +505,7 @@ mesh = SubResource("PlaneMesh_rv2mx")
shape = ExtResource("3_n0qnv")
[node name="Player" parent="." instance=ExtResource("1_lsi31")]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 1.3736)
top_level = true
linear_damp = 3.0
@ -553,7 +566,7 @@ transform = Transform3D(-4.37113e-08, 0, -1, 0, 1, 0, 0.999999, 0, -4.37115e-08,
offset = Vector2(1, 0)
modulate = Color(0.943031, 0.787658, 0.994854, 1)
outline_modulate = Color(0.00803253, 9.36218e-06, 0.0382829, 1)
text = "In this sattion, you need to solve some mathematical
text = "In this station, you need to solve some mathematical
equations (I know, boring) and get the answer right.
If you end up answering even one wrong, you'll have
to restart this entire station. this section also

6
checkpoints.gd Normal file
View file

@ -0,0 +1,6 @@
extends Node
var reachedCheckpoint = 0
func _ready() -> void:
print("owo");

1
checkpoints.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://tfbssbkoeg6p

View file

@ -162,7 +162,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
export_path="Exports/Linux/2025-05-04(viewportscaling)/ProjektLuzid.apk"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
@ -182,10 +182,10 @@ gradle_build/compress_native_libraries=false
gradle_build/export_format=0
gradle_build/min_sdk=""
gradle_build/target_sdk=""
architectures/armeabi-v7a=false
architectures/armeabi-v7a=true
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
architectures/x86_64=true
version/code=1
version/name=""
package/unique_name="com.example.$genname"

View file

@ -14,3 +14,18 @@ background_color = Color(0.6242, 0.697431, 1, 1)
environment = SubResource("Environment_v4kxd")
camera_attributes = SubResource("CameraAttributesPhysical_em7y1")
compositor = SubResource("Compositor_dpk2q")
[node name="Label3D" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.409805, 0.488044, 0)
text = "This is a label"
[node name="Label3D2" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.208084, 0.488044, -0.544811)
text = "This is also a label,
just further away"
[node name="Control" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0

49
main.gd Normal file
View file

@ -0,0 +1,49 @@
extends Node3D
@onready var pause_menu = $PauseMenu
var paused = false
#var showpaused = false
var checkpoint = "checkpoint0"
var checkpoint0 = Vector3(0, 2, 1.374)
var checkpoint1 = Vector3(-27.5, 13, 12.5)
var checkpoint2 = Vector3(0, 22, 1.374)
var time_accum = 0.0 # Timer accumulator
@onready var player = get_node("Player")
func _ready() -> void:
var player = get_node("Player")
# 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):
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"):
player.teleport_to_checkpoint
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

View file

@ -1,21 +0,0 @@
extends Node3D
@onready var pause_menu = $PauseMenu
var paused = false
#var showpaused = false
func _process(delta):
if Input.is_action_just_pressed("ui_cancel"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
pauseMenu()
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

View file

@ -4,13 +4,61 @@ extends RigidBody3D
var mouse_sensitivity := 0.001
var twist_input := 0.0
var pitch_input := 0.0
#@onready var levelcore = get_node("/root/Level_Core/LevelCore")
@onready var twist_pivot := $TwistPivot
@onready var pitch_pivot := $TwistPivot/PitchPivot
# Do not touch this part of the code
@onready var twist_pivot := $TwistPivot
@onready var pitch_pivot := $TwistPivot/PitchPivot
var levelcore: Node
var checkpoint: Vector3
func _ready() -> void:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
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")
checkpoint = levelcore.checkpoint
var player = get_node("/player/Player")
# If touches object
var touched = false
func teleport_to_checkpoint():
if levelcore.has_variable(checkpoint):
var target_position = levelcore.checkpoint
global_transform.origin = target_position
print("teleport to ", target_position, " successful")
else:
print("checkpoint ", checkpoint, " does not exist")
func _integrate_forces(state):
while not get_node_or_null("/root/Level_Core/LevelCore"):
await get_tree().process_frame
levelcore = get_node("/root/Level_Core/LevelCore")
print("levelcore set!")
for i in range(state.get_contact_count()):
var collider = state.get_contact_collider_object(i)
if collider is StaticBody3D and collider.name == "StaticBody3D_S1":
checkpoint = levelcore.checkpoint1
print("chat we hit the checkpoint one")
#func _integrate_forces(state):
# for i in range(state.get_contact_count()):
# var collider = state.get_contact_collider_object(i)
# print("Collided with: ", collider)
# print("Name: ", collider.name)
# if collider is StaticBody3D and collider.name == "StaticBody3D_S1":
# touched = true
# print(">>> MATCH! <<<")
#func _integrate_forces(state):
# for i in range(state.get_contact_count()):
# var collider = state.get_contact_collider_object(i)
# print("Collision with: ", collider)
# if collider:
# print("Name: ", collider.name)
func _process(delta: float) -> void:
var input := Vector3.ZERO

View file

@ -9,6 +9,8 @@ points = PackedVector3Array(-0.125207, -0.532801, -0.480507, 0.0227831, 0.47607,
[node name="Player" type="RigidBody3D"]
lock_rotation = true
contact_monitor = true
max_contacts_reported = 4
script = ExtResource("1_4flbx")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]

View file

@ -27,7 +27,6 @@ DiscordRPCLoader="*res://addons/discord-rpc-gd/nodes/discord_autoload.gd"
window/size/viewport_width=1920
window/size/viewport_height=1080
window/stretch/mode="viewport"
window/stretch/aspect="ignore"
[editor_plugins]
@ -65,6 +64,11 @@ proluz_ui_pause={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
proluz_ui_respawn={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering]