updates. herorganizatie en schilderij

This commit is contained in:
2023-01-31 15:46:07 +01:00
parent 2550625baf
commit 2f6967084e
25 changed files with 198 additions and 57 deletions
+36
View File
@@ -0,0 +1,36 @@
@tool
extends Node3D
const SIZE = 5
enum Direction {UP, RIGHT, DOWN, LEFT}
var sequence = []
# Called when the node enters the scene tree for the first time.
func _ready():
randomize()
var arrow = Image.load_from_file("res://Images/arrow.png")
arrow.convert(Image.FORMAT_RG8)
var painting = Image.create(128*SIZE, 128*SIZE, false, Image.FORMAT_RG8)
var painting_em = Image.create(128*SIZE, 128*SIZE, false, Image.FORMAT_RG8)
painting_em.fill(Color.BLACK)
painting.fill(Color.YELLOW_GREEN)
for x in range(SIZE):
for y in range(SIZE):
var dir = randi() % 4
for i in range(dir):
arrow.rotate_90(0)
painting.blit_rect(arrow, arrow.get_used_rect() ,Vector2i(x*128, y*128))
if randi() % 4 == 0:
painting_em.blit_rect(arrow, arrow.get_used_rect() ,Vector2i(x*128, y*128))
sequence.append(dir)
for i in range(4-dir):
arrow.rotate_90(0)
var texture = ImageTexture.create_from_image(painting)
$Canvas.get_surface_override_material(0).albedo_texture = texture
var texture_em = ImageTexture.create_from_image(painting_em)
$Canvas.get_surface_override_material(0).emission_texture = texture_em
+26
View File
@@ -0,0 +1,26 @@
extends CharacterBody3D
const WALK_SPEED = 5.0
const MOUSE_SENS = 0.002
var mouse_mode = 2
func _ready():
Input.set_mouse_mode(mouse_mode)
func _input(event):
if event is InputEventMouseMotion and mouse_mode == 2:
$Pivot.rotate_y(-event.relative.x*MOUSE_SENS)
$Pivot/Camera.rotate_x(-event.relative.y*MOUSE_SENS)
elif event.is_action_pressed("mode"):
mouse_mode = mouse_mode ^ 1
Input.set_mouse_mode(mouse_mode)
func _physics_process(delta):
if mouse_mode == 2:
var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
var direction = ($Pivot.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
velocity.x = direction.x * WALK_SPEED
velocity.z = direction.z * WALK_SPEED
move_and_slide()
+18
View File
@@ -0,0 +1,18 @@
extends Node3D
func _ready():
pass
func get_number():
return 1000 * $Body/"1"/Cylinder/StaticBody3D.number + \
100 * $Body/"2"/Cylinder/StaticBody3D.number + \
10 * $Body/"3"/Cylinder/StaticBody3D.number + \
$Body/"4"/Cylinder/StaticBody3D.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:
$Lamp.light_color = Color.LIGHT_GREEN
$Congratulations.playing = true
+9
View File
@@ -0,0 +1,9 @@
extends StaticBody3D
var number = 0
func _on_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
$"..".rotate_x(PI/5)
$Audio.playing = true
number = (number + 1) % 10
+6
View File
@@ -0,0 +1,6 @@
extends StaticBody3D
func _on_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
$Light.visible = !$Light.visible
$Audio.playing = true