level resetting works
This commit is contained in:
parent
a1f4eaa2c6
commit
d2dfb65d59
4 changed files with 40 additions and 59 deletions
|
|
@ -108,15 +108,16 @@ material = SubResource("StandardMaterial3D_itc1d")
|
|||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_y4l56"]
|
||||
|
||||
[node name="ChronoManager" type="Node3D" node_paths=PackedStringArray("gui", "pedestals", "chime_player", "world_env", "player")]
|
||||
[node name="ChronoManager" type="Node3D" node_paths=PackedStringArray("gui", "pedstalContainer", "chime_player", "world_env", "player", "player_spawn")]
|
||||
script = ExtResource("1_5b2rd")
|
||||
pedestal_off_mat = ExtResource("2_0aj3l")
|
||||
pedestal_on_mat = ExtResource("3_mnhg8")
|
||||
gui = NodePath("Gui")
|
||||
pedestals = [NodePath("Pedestals/CommandPedestal"), NodePath("Pedestals/CommandPedestal2"), NodePath("Pedestals/CommandPedestal3"), NodePath("Pedestals/CommandPedestal4"), NodePath("Pedestals/CommandPedestal5"), NodePath("Pedestals/CommandPedestal6"), NodePath("Pedestals/CommandPedestal7"), NodePath("Pedestals/CommandPedestal8"), NodePath("Pedestals/CommandPedestal9"), NodePath("Pedestals/CommandPedestal10")]
|
||||
pedstalContainer = NodePath("Pedestals")
|
||||
chime_player = NodePath("AudioStreamPlayer")
|
||||
world_env = NodePath("WorldEnvironment")
|
||||
player = NodePath("Player")
|
||||
player_spawn = NodePath("PlayerStartPos")
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_hsi55")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.12895, 0)
|
||||
|
|
@ -193,5 +194,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.5, 1, 1.5)
|
|||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("12_bm4h4")
|
||||
|
||||
[node name="PlayerStartPos" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[connection signal="broadcast" from="." to="Player" method="_on_chrono_manager_broadcast"]
|
||||
[connection signal="object_clicked" from="Player" to="." method="_on_player_object_clicked"]
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ signal broadcast(command : String)
|
|||
var tick_timer : float = 0
|
||||
var room_started : bool = false
|
||||
var current_tick = 0
|
||||
var failed : bool = false
|
||||
var fail_timer : float = 3
|
||||
|
||||
@export_group("Resources")
|
||||
@export var pedestal_off_mat : Material
|
||||
|
|
@ -18,13 +20,18 @@ var current_tick = 0
|
|||
|
||||
@export_group("Node References")
|
||||
@export var gui : Control
|
||||
@export var pedestals : Array[Pedestal]
|
||||
var pedestals : Array[Pedestal]
|
||||
@export var pedstalContainer : Node3D
|
||||
@export var chime_player : AudioStreamPlayer
|
||||
@export var world_env : WorldEnvironment
|
||||
@export var player : CharacterBody3D
|
||||
@export var player_spawn : Node3D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var temp_pedestals = pedstalContainer.get_children()
|
||||
for temp in temp_pedestals:
|
||||
pedestals.append(temp)
|
||||
for i in pedestals.size():
|
||||
pedestals[i].mesh.mesh = pedestals[i].mesh.mesh.duplicate()
|
||||
pass # Replace with function body.
|
||||
|
|
@ -41,7 +48,7 @@ func _process(delta):
|
|||
if room_started and current_tick < level_time+1:
|
||||
tick_timer += delta
|
||||
|
||||
if tick_timer > level_tick:
|
||||
if tick_timer > level_tick: #advance tick
|
||||
if current_tick == 11:
|
||||
#fail_room()
|
||||
pass
|
||||
|
|
@ -62,6 +69,17 @@ func _process(delta):
|
|||
chime_player.volume_db = -10
|
||||
chime_player.pitch_scale = 0.5
|
||||
chime_player.play()
|
||||
|
||||
if failed:
|
||||
world_env.environment.background_color = Color.DIM_GRAY
|
||||
fail_timer -= delta
|
||||
if fail_timer < 0:
|
||||
fail_timer = 3
|
||||
reset_room()
|
||||
else:
|
||||
world_env.environment.background_color = Color.WHITE
|
||||
|
||||
|
||||
|
||||
#world_env.environment.fog_enabled = room_failed #this whole section is cooked
|
||||
#if room_failed:
|
||||
|
|
@ -97,17 +115,27 @@ func start_room():
|
|||
|
||||
func fail_room():
|
||||
print("ROOM FAILED")
|
||||
|
||||
room_started = false
|
||||
player.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
failed = true
|
||||
# close exit, freeze player?
|
||||
pass
|
||||
|
||||
func reset_room():
|
||||
print("RESETTING ROOM")
|
||||
room_started = false
|
||||
player.global_position = player_spawn.global_position
|
||||
player.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
player.rotation_degrees = Vector3(0,0,0)
|
||||
player.camera.rotation_degrees = Vector3(0,0,0)
|
||||
|
||||
tick_timer = 0
|
||||
|
||||
tick_timer = 0
|
||||
room_started = false
|
||||
current_tick = 0
|
||||
failed = false
|
||||
fail_timer = 3
|
||||
|
||||
#reset pedestals
|
||||
for i in pedestals.size():
|
||||
var activated_pedestal = pedestals[i]
|
||||
activated_pedestal.mesh.mesh.material = pedestal_off_mat
|
||||
|
|
|
|||
|
|
@ -1,20 +1,13 @@
|
|||
extends Control
|
||||
|
||||
@export_group("Node References")
|
||||
@export var terminal_panel : Control
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
terminal_panel.visible = false
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
|
||||
func close_terminal():
|
||||
terminal_panel.visible = false
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
|
|
|||
46
gui.tscn
46
gui.tscn
|
|
@ -6,7 +6,7 @@
|
|||
[sub_resource type="LabelSettings" id="LabelSettings_lrnc3"]
|
||||
font_color = Color(1, 0, 0, 1)
|
||||
|
||||
[node name="Gui" type="Control" node_paths=PackedStringArray("terminal_panel")]
|
||||
[node name="Gui" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
|
@ -14,7 +14,6 @@ anchor_bottom = 1.0
|
|||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_7s0l7")
|
||||
terminal_panel = NodePath("Terminal")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
|
|
@ -37,46 +36,3 @@ custom_minimum_size = Vector2(10, 10)
|
|||
layout_mode = 2
|
||||
texture = ExtResource("1_mpwvh")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Terminal" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Terminal"]
|
||||
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 = 75
|
||||
theme_override_constants/margin_right = 200
|
||||
theme_override_constants/margin_bottom = 75
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="Terminal/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Terminal/MarginContainer/PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Terminal/MarginContainer/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Terminal UI"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="Terminal/MarginContainer/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Available commands: 3x Jump, 1x Dash"
|
||||
|
||||
[node name="CloseButton" type="Button" parent="Terminal/MarginContainer/PanelContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
text = "X"
|
||||
|
||||
[connection signal="pressed" from="Terminal/MarginContainer/PanelContainer/CloseButton" to="." method="close_terminal"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue