cool stuff

This commit is contained in:
Tabby 2025-05-25 15:14:49 +10:00
parent a9be913adb
commit 44be9924a6
11 changed files with 202 additions and 29 deletions

View file

@ -20,6 +20,7 @@ var door_timer : float = 0
@export_group("Resources")
@export var pedestal_off_mat : Material
@export var pedestal_on_mat : Material
@export var pedestal_activated_cols : Array[Material]
@export_group("Node References")
@export var gui : Control
@ -57,8 +58,8 @@ func _process(delta):
#if Input.is_action_just_pressed("debug_start"):
#start_room()
if Input.is_action_just_pressed("interact"):
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
#if Input.is_action_just_pressed("interact"):
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
if Input.is_action_just_pressed("reset"):
gui.show_lose_screen("Reset Pressed", 2)
@ -81,7 +82,8 @@ func _process(delta):
for i in pedestals.size():
if i+1 == current_tick:
var activated_pedestal = pedestals[i]
activated_pedestal.mesh.mesh.material = pedestal_on_mat
#activated_pedestal.mesh.mesh.material = pedestal_on_mat
activated_pedestal.mesh.mesh.material = pedestal_activated_cols[i]
if activated_pedestal.has_command:
print("broadcasting: " + activated_pedestal.placed_command.command_name)
broadcast.emit(activated_pedestal.placed_command.command_name)
@ -190,3 +192,8 @@ func _player_area_entered(area : Area3D):
if not player.collider.disabled:
fail_room()
gui.show_lose_screen("Touched a reset block", 2)
func pause():
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
gui.open_pause()
process_mode = Node.PROCESS_MODE_DISABLED

View file

@ -39,10 +39,11 @@ func _physics_process(delta):
#free the mouse for debugging
if Input.is_action_just_pressed("esc"):
if (Input.mouse_mode == Input.MOUSE_MODE_CAPTURED):
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
#if (Input.mouse_mode == Input.MOUSE_MODE_CAPTURED):
#Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
#else:
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
get_parent().pause()
# interact with stuff
if Input.is_action_just_pressed("drop"):

View file

@ -8,12 +8,17 @@ extends Control
@export var level_title : Label
@export var clock_progress : TextureProgressBar
@export var clock_label : Label
@export var volume_slider : HSlider
@export var level_name : Label
@export var pause_menu : MarginContainer
var title_fade : float = 2.5
var sound = AudioServer.get_bus_index("Master")
# Called when the node enters the scene tree for the first time.
func _ready():
lose_panel.visible = false
volume_slider.value = db_to_linear(AudioServer.get_bus_volume_db(sound))
pass # Replace with function body.
@ -37,6 +42,7 @@ func hide_lose_screen():
func show_level_title(title : String):
level_title.text = title
level_name.text = title
title_fade = 2
func onTick(tick : int):
@ -45,3 +51,20 @@ func onTick(tick : int):
clock_label.text = str(10)
else:
clock_label.text = str(tick)
func open_pause():
pause_menu.show()
func close_pause():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
pause_menu.hide()
get_parent().process_mode = Node.PROCESS_MODE_INHERIT
func goto_menu():
get_tree().change_scene_to_file(GameManager.menu_scene_path)
func _on_h_slider_value_changed(value: float) -> void:
AudioServer.set_bus_volume_db(sound, linear_to_db(value))