42 lines
1.2 KiB
GDScript
42 lines
1.2 KiB
GDScript
extends Node3D
|
|
|
|
var sequence
|
|
var sequence_guess = []
|
|
var i = 0
|
|
|
|
func _ready():
|
|
sequence = $".."/Painting.sequence
|
|
|
|
|
|
func add_sequence_guess(dir):
|
|
if sequence[i] == dir:
|
|
$Button.playing = true
|
|
i += 1
|
|
if (i == sequence.size()):
|
|
$Door.visible = false
|
|
$Open.playing = true
|
|
i = 0
|
|
else:
|
|
$Reset.playing = true
|
|
i = 0
|
|
|
|
func _on_up_input_event(camera, event, position, normal, shape_idx):
|
|
if event is InputEventMouseButton and event.is_action_pressed("interact"):
|
|
add_sequence_guess(0)
|
|
|
|
func _on_left_input_event(camera, event, position, normal, shape_idx):
|
|
if event is InputEventMouseButton and event.is_action_pressed("interact"):
|
|
add_sequence_guess(3)
|
|
|
|
func _on_down_input_event(camera, event, position, normal, shape_idx):
|
|
if event is InputEventMouseButton and event.is_action_pressed("interact"):
|
|
add_sequence_guess(2)
|
|
|
|
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
|