Random combination code

This commit is contained in:
2023-02-02 11:41:24 +01:00
parent e046ed821e
commit 75a9075694
6 changed files with 41 additions and 73 deletions
+5 -2
View File
@@ -1,7 +1,10 @@
extends Node3D
var combination
func _ready():
pass
combination = randi() % 10000
$".."/CombiCode.mesh.text = str(combination)
func get_number():
return 1000 * $Body/"1"/Cylinder/StaticBody3D.number + \
@@ -13,6 +16,6 @@ func get_number():
func _on_static_body_3d_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
$Body/Knop/Audio.playing = true
if get_number() == 1984:
if get_number() == combination:
$Lamp.light_color = Color.LIGHT_GREEN
$Congratulations.playing = true