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
Binary file not shown.
-30
View File
@@ -1,30 +0,0 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://dv3a33uojtwi0"
path="res://.godot/imported/tekst.glb-5a5dc8db74b37318106f1ff67e5c8256.scn"
[deps]
source_file="res://Objects/Meshes/tekst.glb"
dest_files=["res://.godot/imported/tekst.glb-5a5dc8db74b37318106f1ff67e5c8256.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
import_script/path=""
_subresources={}
-35
View File
@@ -1,35 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://bmqy37qumb7um"]
[ext_resource type="PackedScene" uid="uid://dv3a33uojtwi0" path="res://Objects/Meshes/tekst.glb" id="1_riskl"]
[sub_resource type="Shader" id="Shader_qmlbg"]
code = "// NOTE: Shader automatically converted from Godot Engine 4.0.beta15's StandardMaterial3D.
shader_type spatial;
render_mode specular_disabled;
void light() {
float diff = LIGHT_COLOR.b - LIGHT_COLOR.g - LIGHT_COLOR.r;
if (diff > 0.5 && LIGHT_COLOR.b > LIGHT_COLOR.g && LIGHT_COLOR.b > LIGHT_COLOR.r) {
DIFFUSE_LIGHT += clamp(dot(NORMAL, LIGHT), 0.0, 1.0) * ATTENUATION * ALBEDO;
ALPHA = ATTENUATION;
}
}
void fragment() {
ALBEDO = vec3(0.4, 0.8, 1.0);
EMISSION = vec3(0.4, 0.8, 1.0);
ALPHA = 0.0;
}
"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_q8ihn"]
render_priority = 0
shader = SubResource("Shader_qmlbg")
[node name="tekst" instance=ExtResource("1_riskl")]
[node name="Text" parent="." index="0"]
surface_material_override/0 = SubResource("ShaderMaterial_q8ihn")
+16 -6
View File
File diff suppressed because one or more lines are too long
+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
+20
View File
@@ -0,0 +1,20 @@
// NOTE: Shader automatically converted from Godot Engine 4.0.beta15's StandardMaterial3D.
shader_type spatial;
render_mode specular_disabled;
void light() {
float diff = LIGHT_COLOR.b - LIGHT_COLOR.g - LIGHT_COLOR.r;
if (diff > 0.5 && LIGHT_COLOR.b > LIGHT_COLOR.g && LIGHT_COLOR.b > LIGHT_COLOR.r) {
DIFFUSE_LIGHT += clamp(dot(NORMAL, LIGHT), 0.0, 1.0) * ATTENUATION * ALBEDO;
ALPHA = ATTENUATION;
}
}
void fragment() {
ALBEDO = vec3(0.4, 0.8, 1.0);
EMISSION = vec3(0.4, 0.8, 1.0);
ALPHA = 0.0;
}