Various updates

Flashlight, fog, letter shader, safe audio
This commit is contained in:
2023-01-31 19:11:38 +01:00
parent 61a732a698
commit 9b7b25ff94
13 changed files with 162 additions and 30 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
@tool
extends Node3D
const SIZE = 3
const SIZE = 4
enum Direction {UP, RIGHT, DOWN, LEFT}
var sequence = []
+9
View File
@@ -3,6 +3,7 @@ extends CharacterBody3D
const WALK_SPEED = 5.0
const MOUSE_SENS = 0.002
var has_flashlight = false
var mouse_mode = 2
@@ -16,6 +17,8 @@ func _input(event):
elif event.is_action_pressed("mode"):
mouse_mode = mouse_mode ^ 1
Input.set_mouse_mode(mouse_mode)
elif event.is_action_pressed("alt") and has_flashlight:
$Pivot/Camera/FlashLight/SpotLight3D.visible = !$Pivot/Camera/FlashLight/SpotLight3D.visible
func _physics_process(delta):
if mouse_mode == 2:
@@ -24,3 +27,9 @@ func _physics_process(delta):
velocity.x = direction.x * WALK_SPEED
velocity.z = direction.z * WALK_SPEED
move_and_slide()
func _on_flash_light_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
$Pivot/Camera/FlashLight.visible = true
has_flashlight = true
+8 -3
View File
@@ -10,6 +10,7 @@ func _ready():
bmat.emission_enabled = true
bmat.albedo_color = Color.LIGHT_SLATE_GRAY
bmat.emission = Color.LIGHT_BLUE
bmat.emission_intensity = 0.05
$ButtonUp.set_surface_override_material(0, bmat)
$ButtonLeft.set_surface_override_material(0, bmat)
$ButtonDown.set_surface_override_material(0, bmat)
@@ -17,10 +18,9 @@ func _ready():
func add_sequence_guess(dir):
if sequence[i] == dir:
print(".")
$Button.playing = true
i += 1
if (i == sequence.size()):
print("yay")
$Door.visible = false
$ButtonUp.visible = false
$ButtonDown.visible = false
@@ -28,7 +28,7 @@ func add_sequence_guess(dir):
$ButtonRight.visible = false
i = 0
else:
print("x")
$Reset.playing = true
i = 0
func _on_up_input_event(camera, event, position, normal, shape_idx):
@@ -46,3 +46,8 @@ func _on_down_input_event(camera, event, position, normal, shape_idx):
func _on_right_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
add_sequence_guess(1)
func _on_flash_light_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
$FlashLight.visible = false