From 7faf85ad9bd737db35e42c1043c03e451d4fcd84 Mon Sep 17 00:00:00 2001 From: Mark Hoekveen Date: Wed, 8 Feb 2023 19:09:47 +0100 Subject: [PATCH] geluid voor laatje en kastje --- Kamer.tscn | 44 ++++++++++++++++++++-------------------- Objects/ladekast.tscn | 8 +++++++- Objects/lichtkastje.tscn | 7 ++++++- Scripts/ladekast.gd | 13 ++++++++++-- Scripts/lichtkastje.gd | 1 + 5 files changed, 47 insertions(+), 26 deletions(-) diff --git a/Kamer.tscn b/Kamer.tscn index ef45d7a..ef997f7 100644 --- a/Kamer.tscn +++ b/Kamer.tscn @@ -20,50 +20,50 @@ [ext_resource type="FontFile" uid="uid://ba6teo1asddxo" path="res://Fonts/Galimer-ExtraLight.ttf" id="17_7yj1s"] [ext_resource type="Script" path="res://Scripts/Gui.gd" id="18_80vxw"] -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_78vk0"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_sdh8b"] transparency = 1 albedo_color = Color(0.14902, 0.152941, 0.164706, 0.47451) -[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_nikfu"] +[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_806y0"] points = PackedVector3Array(-1.05, -0.5247, -0.4794, -2.4247e-05, 0.5253, 0.5706, -2.4247e-05, 0.5253, -0.4794, -2.4247e-05, -0.5247, 0.5706, -1.05, 0.5253, 0.5706, -2.4247e-05, -0.5247, -0.4794, -1.05, 0.5253, -0.4794, -1.05, -0.5247, 0.5706) -[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_yxpwa"] +[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_p6xsf"] data = PackedVector3Array(-2.0289, -1.2789, 2.0289, -2.0289, 1.2789, 2.0289, -2.0289, 1.2789, -2.0289, -2.0289, -1.2789, 2.0289, -2.0289, 1.2789, -2.0289, -2.0289, -1.2789, -2.0289, 2.0289, -1.2789, -2.0289, 2.0289, 1.2789, -2.0289, 2.0289, 1.2789, 2.0289, 2.0289, -1.2789, -2.0289, 2.0289, 1.2789, 2.0289, 2.0289, -1.2789, 2.0289, -2.0289, -1.2789, -2.0289, -2.0289, 1.2789, -2.0289, 2.0289, 1.2789, -2.0289, -2.0289, -1.2789, -2.0289, 2.0289, 1.2789, -2.0289, 2.0289, -1.2789, -2.0289, -0.5269, -1.2789, 2.0289, -0.5269, 0.9153, 2.0289, -2.0289, 1.2789, 2.0289, -0.5269, -1.2789, 2.0289, -2.0289, 1.2789, 2.0289, -2.0289, -1.2789, 2.0289, 0.5269, 0.9153, 2.0289, 0.5269, -1.2789, 2.0289, 2.0289, -1.2789, 2.0289, 0.5269, 0.9153, 2.0289, 2.0289, -1.2789, 2.0289, 2.0289, 1.2789, 2.0289, -0.5269, 0.9153, 2.0289, 0.5269, 0.9153, 2.0289, 2.0289, 1.2789, 2.0289, -0.5269, 0.9153, 2.0289, 2.0289, 1.2789, 2.0289, -2.0289, 1.2789, 2.0289, 0.5269, -1.2789, 2.0289, -0.5269, -1.2789, 2.0289, 2.0289, -1.2789, 2.0289, -0.5269, -1.2789, 2.0289, -2.0289, -1.2789, 2.0289, 2.0289, -1.2789, 2.0289, 0.8296, 1.2789, 0.8296, -0.8296, 1.2789, 0.8296, -2.0289, 1.2789, 2.0289, 0.8296, 1.2789, 0.8296, -2.0289, 1.2789, 2.0289, 2.0289, 1.2789, 2.0289, 0.8296, 1.2789, -0.8296, 0.8296, 1.2789, 0.8296, 2.0289, 1.2789, 2.0289, 0.8296, 1.2789, -0.8296, 2.0289, 1.2789, 2.0289, 2.0289, 1.2789, -2.0289, -0.8296, 1.2789, 0.8296, -0.8296, 1.2789, -0.8296, -2.0289, 1.2789, -2.0289, -0.8296, 1.2789, 0.8296, -2.0289, 1.2789, -2.0289, -2.0289, 1.2789, 2.0289, -0.8296, 1.2789, -0.8296, 0.8296, 1.2789, -0.8296, 2.0289, 1.2789, -2.0289, -0.8296, 1.2789, -0.8296, 2.0289, 1.2789, -2.0289, -2.0289, 1.2789, -2.0289, -2.0731, -1.3202, 2.0702, -2.0711, -1.3211, -2.0711, -2.066, 1.3276, -2.071, -2.0731, -1.3202, 2.0702, -2.066, 1.3276, -2.071, -2.071, 1.3276, 2.066, -2.0711, -1.3211, -2.0711, -2.0731, -1.3202, 2.0702, 2.0731, -1.3202, 2.0702, -2.0711, -1.3211, -2.0711, 2.0731, -1.3202, 2.0702, 2.0711, -1.3212, -2.0711, 2.0711, -1.3212, -2.0711, 2.0731, -1.3202, 2.0702, 2.071, 1.3276, 2.066, 2.0711, -1.3212, -2.0711, 2.071, 1.3276, 2.066, 2.066, 1.3276, -2.071, -2.0711, -1.3211, -2.0711, 2.0711, -1.3212, -2.0711, 2.066, 1.3276, -2.071, -2.0711, -1.3211, -2.0711, 2.066, 1.3276, -2.071, -2.066, 1.3276, -2.071, -0.5269, -1.2789, 2.0711, -2.0731, -1.3202, 2.0702, -2.071, 1.3276, 2.066, -0.5269, -1.2789, 2.0711, -2.071, 1.3276, 2.066, -0.5269, 0.9153, 2.0711, 0.5269, 0.9153, 2.0711, 2.071, 1.3276, 2.066, 2.0731, -1.3202, 2.0702, 0.5269, 0.9153, 2.0711, 2.0731, -1.3202, 2.0702, 0.5269, -1.2789, 2.0711, -0.5269, 0.9153, 2.0711, -2.071, 1.3276, 2.066, 2.071, 1.3276, 2.066, -0.5269, 0.9153, 2.0711, 2.071, 1.3276, 2.066, 0.5269, 0.9153, 2.0711, 0.5269, -1.2789, 2.0711, 2.0731, -1.3202, 2.0702, -2.0731, -1.3202, 2.0702, 0.5269, -1.2789, 2.0711, -2.0731, -1.3202, 2.0702, -0.5269, -1.2789, 2.0711, 0.8294, 1.6416, 0.8294, 2.071, 1.3276, 2.066, -2.071, 1.3276, 2.066, 0.8294, 1.6416, 0.8294, -2.071, 1.3276, 2.066, -0.8294, 1.6416, 0.8294, 0.8294, 1.6416, -0.8294, 2.066, 1.3276, -2.071, 2.071, 1.3276, 2.066, 0.8294, 1.6416, -0.8294, 2.071, 1.3276, 2.066, 0.8294, 1.6416, 0.8294, -0.8294, 1.6416, 0.8294, -2.071, 1.3276, 2.066, -2.066, 1.3276, -2.071, -0.8294, 1.6416, 0.8294, -2.066, 1.3276, -2.071, -0.8294, 1.6416, -0.8294, -0.8294, 1.6416, -0.8294, -2.066, 1.3276, -2.071, 2.066, 1.3276, -2.071, -0.8294, 1.6416, -0.8294, 2.066, 1.3276, -2.071, 0.8294, 1.6416, -0.8294, -0.8296, 1.2789, 0.8296, 0.8296, 1.2789, 0.8296, 0.8294, 1.6416, 0.8294, -0.8296, 1.2789, 0.8296, 0.8294, 1.6416, 0.8294, -0.8294, 1.6416, 0.8294, 0.5269, 0.9153, 2.0289, -0.5269, 0.9153, 2.0289, -0.5269, 0.9153, 2.0711, 0.5269, 0.9153, 2.0289, -0.5269, 0.9153, 2.0711, 0.5269, 0.9153, 2.0711, 0.8296, 1.2789, -0.8296, -0.8296, 1.2789, -0.8296, -0.8294, 1.6416, -0.8294, 0.8296, 1.2789, -0.8296, -0.8294, 1.6416, -0.8294, 0.8294, 1.6416, -0.8294, -0.5269, 0.9153, 2.0289, -0.5269, -1.2789, 2.0289, -0.5269, -1.2789, 2.0711, -0.5269, 0.9153, 2.0289, -0.5269, -1.2789, 2.0711, -0.5269, 0.9153, 2.0711, 0.8296, 1.2789, 0.8296, 0.8296, 1.2789, -0.8296, 0.8294, 1.6416, -0.8294, 0.8296, 1.2789, 0.8296, 0.8294, 1.6416, -0.8294, 0.8294, 1.6416, 0.8294, -0.5269, -1.2789, 2.0289, 0.5269, -1.2789, 2.0289, 0.5269, -1.2789, 2.0711, -0.5269, -1.2789, 2.0289, 0.5269, -1.2789, 2.0711, -0.5269, -1.2789, 2.0711, 0.5269, -1.2789, 2.0289, 0.5269, 0.9153, 2.0289, 0.5269, 0.9153, 2.0711, 0.5269, -1.2789, 2.0289, 0.5269, 0.9153, 2.0711, 0.5269, -1.2789, 2.0711, -0.8296, 1.2789, -0.8296, -0.8296, 1.2789, 0.8296, -0.8294, 1.6416, 0.8294, -0.8296, 1.2789, -0.8296, -0.8294, 1.6416, 0.8294, -0.8294, 1.6416, -0.8294, -2.0289, -1.2789, -2.0289, 2.0289, -1.2789, -2.0289, 2.0289, -1.2789, 2.0289, -2.0289, -1.2789, -2.0289, 2.0289, -1.2789, 2.0289, -2.0289, -1.2789, 2.0289) -[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_bxgh2"] +[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_247g8"] panorama = ExtResource("2_2aenl") -[sub_resource type="Sky" id="Sky_eixpi"] -sky_material = SubResource("PanoramaSkyMaterial_bxgh2") +[sub_resource type="Sky" id="Sky_mcwns"] +sky_material = SubResource("PanoramaSkyMaterial_247g8") radiance_size = 1 -[sub_resource type="Environment" id="Environment_xu0tm"] +[sub_resource type="Environment" id="Environment_gpnv6"] background_mode = 2 background_energy_multiplier = 0.5 -sky = SubResource("Sky_eixpi") +sky = SubResource("Sky_mcwns") ambient_light_sky_contribution = 0.01 reflected_light_source = 1 tonemap_mode = 3 ssao_enabled = true volumetric_fog_density = 0.1529 -[sub_resource type="CapsuleMesh" id="CapsuleMesh_2anhq"] +[sub_resource type="CapsuleMesh" id="CapsuleMesh_noj62"] height = 3.703 -[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_6cmwy"] +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_tniqu"] radius = 0.8 height = 4.5 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_fxqfk"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_dmpo6"] render_priority = 0 shader = ExtResource("8_oclf0") -[sub_resource type="TextMesh" id="TextMesh_xx8lm"] -material = SubResource("ShaderMaterial_fxqfk") +[sub_resource type="TextMesh" id="TextMesh_kh0rx"] +material = SubResource("ShaderMaterial_dmpo6") text = "1984" depth = 0.01 -[sub_resource type="BoxShape3D" id="BoxShape3D_ahrce"] +[sub_resource type="BoxShape3D" id="BoxShape3D_pdj5f"] [node name="kamer" instance=ExtResource("1_50aco")] script = ExtResource("2_m2v8w") @@ -104,7 +104,7 @@ omni_range = 10.0 omni_attenuation = 0.435276 [node name="Dakraam" parent="Room" index="0"] -surface_material_override/0 = SubResource("StandardMaterial3D_78vk0") +surface_material_override/0 = SubResource("StandardMaterial3D_sdh8b") [node name="Doorframe" parent="Room" index="1"] cast_shadow = 0 @@ -115,7 +115,7 @@ transform = Transform3D(0.948, 0, 0, 0, 0.955, 0, 0, 0, 0.7, 0.472735, -0.031484 [node name="Deur" type="StaticBody3D" parent="Room/Doorframe/Door" index="0"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Room/Doorframe/Door/Deur" index="0"] -shape = SubResource("ConvexPolygonShape3D_nikfu") +shape = SubResource("ConvexPolygonShape3D_806y0") [node name="OmniLight3D2" type="OmniLight3D" parent="Room" index="2"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.533369, 1.60456, -0.629147) @@ -130,10 +130,10 @@ omni_attenuation = 0.108819 [node name="StaticBody3D" type="StaticBody3D" parent="Room" index="3"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Room/StaticBody3D" index="0"] -shape = SubResource("ConcavePolygonShape3D_yxpwa") +shape = SubResource("ConcavePolygonShape3D_p6xsf") [node name="WorldEnvironment" type="WorldEnvironment" parent="." index="4"] -environment = SubResource("Environment_xu0tm") +environment = SubResource("Environment_gpnv6") [node name="Zon" type="DirectionalLight3D" parent="." index="5"] transform = Transform3D(0.744253, 0.38803, -0.543618, 0.0836868, 0.753332, 0.652294, 0.662634, -0.530966, 0.528196, 0, 4.22767, 0) @@ -158,7 +158,7 @@ transform = Transform3D(1.19249e-08, 0, -1, 0, 1, 0, 1, 0, 1.19249e-08, 1.969, 0 [node name="FlashLight" type="MeshInstance3D" parent="." index="9"] transform = Transform3D(0.0965925, -0.0258819, -1.13134e-09, 0, -4.37114e-09, 0.1, -0.0258819, -0.0965925, -4.2222e-09, -1.21576, -0.391011, -1.00824) -mesh = SubResource("CapsuleMesh_2anhq") +mesh = SubResource("CapsuleMesh_noj62") skeleton = NodePath("../safe") [node name="FlashLight" type="StaticBody3D" parent="FlashLight" index="0"] @@ -167,7 +167,7 @@ collision_layer = 2 [node name="CollisionShape3D" type="CollisionShape3D" parent="FlashLight/FlashLight" index="0"] transform = Transform3D(1, 0, 8.88178e-16, 0, 1, -7.10543e-15, 0, 0, 1, 0, 0, 0) -shape = SubResource("CapsuleShape3D_6cmwy") +shape = SubResource("CapsuleShape3D_tniqu") [node name="safe" parent="." index="10" instance=ExtResource("6_3qx7f")] transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, -1.50079, -0.0682462, -1.05664) @@ -177,7 +177,7 @@ transform = Transform3D(-8.74228e-09, 0, 0.2, 0, 0.2, 0, -0.2, 0, -8.74228e-09, [node name="CombiCode" type="MeshInstance3D" parent="." index="12"] transform = Transform3D(0.709362, 0.443678, -0.547682, -5.96046e-08, 0.777026, 0.62947, 0.704845, -0.446522, 0.551192, 1.84123, -0.566121, -1.81842) -mesh = SubResource("TextMesh_xx8lm") +mesh = SubResource("TextMesh_kh0rx") [node name="Slot" parent="." index="13" instance=ExtResource("9_pjl12")] transform = Transform3D(-4.37114e-09, 0, 0.1, 0, 0.1, 0, -0.1, 0, -4.37114e-09, -1.95266, 0.0372345, 0.0309203) @@ -203,7 +203,7 @@ script = ExtResource("13_srhqr") [node name="CollisionShape3D" type="CollisionShape3D" parent="Einde" index="0"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.113057) -shape = SubResource("BoxShape3D_ahrce") +shape = SubResource("BoxShape3D_pdj5f") [node name="Wincamera" type="Camera3D" parent="Einde" index="1"] transform = Transform3D(-0.717378, 0.325996, 0.615708, 0.022655, 0.894217, -0.447061, -0.696316, -0.306763, -0.648877, -0.0045743, -0.224675, 3.27438) diff --git a/Objects/ladekast.tscn b/Objects/ladekast.tscn index 6b7e8ed..f88cf82 100644 --- a/Objects/ladekast.tscn +++ b/Objects/ladekast.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=9 format=3 uid="uid://bmuy4jimpch1i"] +[gd_scene load_steps=10 format=3 uid="uid://bmuy4jimpch1i"] [ext_resource type="PackedScene" uid="uid://bjbpkdxe3m235" path="res://Objects/Meshes/ladekast.glb" id="1_gw865"] [ext_resource type="Script" path="res://Scripts/ladekast.gd" id="2_y7ua8"] +[ext_resource type="AudioStream" uid="uid://d3b8cg7uqtmbh" path="res://Audio/drawer-open.wav" id="3_o5rq1"] [sub_resource type="BoxShape3D" id="BoxShape3D_yanin"] size = Vector3(1.8, 0.3, 0.2) @@ -74,6 +75,11 @@ collision_priority = 2.0 [node name="CollisionShape3D" type="CollisionShape3D" parent="Kast/Drawer/Sleutel/Sleutel" index="0"] shape = SubResource("SphereShape3D_kdt4n") +[node name="DrawerSound" type="AudioStreamPlayer3D" parent="Kast/Drawer" index="2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.83471, 1.16603) +stream = ExtResource("3_o5rq1") +unit_size = 3.3 + [node name="StaticBody3D" type="StaticBody3D" parent="Kast" index="5"] input_ray_pickable = false diff --git a/Objects/lichtkastje.tscn b/Objects/lichtkastje.tscn index 936ded6..069bf4c 100644 --- a/Objects/lichtkastje.tscn +++ b/Objects/lichtkastje.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=6 format=3 uid="uid://b5rve73suh7fc"] +[gd_scene load_steps=7 format=3 uid="uid://b5rve73suh7fc"] [ext_resource type="PackedScene" uid="uid://dnho3rpbb72mw" path="res://Objects/Meshes/lichtkastje.glb" id="1_je302"] [ext_resource type="Script" path="res://Scripts/lichtkastje.gd" id="2_m7o1t"] +[ext_resource type="AudioStream" uid="uid://c6ghhps67gscc" path="res://Audio/lock-open.wav" id="3_ukf3n"] [sub_resource type="BoxShape3D" id="BoxShape3D_bfy6m"] size = Vector3(1, 10, 18) @@ -22,6 +23,10 @@ script = ExtResource("2_m7o1t") [node name="CollisionShape3D" type="CollisionShape3D" parent="Lock/Lock" index="0"] shape = SubResource("BoxShape3D_bfy6m") +[node name="DeurOpen" type="AudioStreamPlayer3D" parent="Lock" index="1"] +stream = ExtResource("3_ukf3n") +unit_size = 1.07 + [node name="Lever" parent="." index="4"] transform = Transform3D(0.0287741, 0, 0, 0, 0.208095, 0, 0, 0, 0.208095, -0.182957, 0, 0) surface_material_override/0 = SubResource("StandardMaterial3D_smcqf") diff --git a/Scripts/ladekast.gd b/Scripts/ladekast.gd index 0b7dcd3..86a5303 100644 --- a/Scripts/ladekast.gd +++ b/Scripts/ladekast.gd @@ -1,9 +1,18 @@ extends Node3D +var open = false +var sound_open = preload("res://Audio/drawer-open.wav") +var sound_close = preload("res://Audio/drawer-close.wav") + func _on_static_body_3d_input_event(_camera, event, _position, _normal, _shape_idx): if event is InputEventMouseButton and event.is_action_pressed("interact"): - print("Laatje!") - $Kast/Drawer.position.z = abs($Kast/Drawer.position.z - 1.0) + if open: + $Kast/Drawer/DrawerSound.stream = sound_close + else: + $Kast/Drawer/DrawerSound.stream = sound_open + open = !open + $Kast/Drawer.position.z = abs($Kast/Drawer.position.z - 1.0) + $Kast/Drawer/DrawerSound.playing = true func _on_sleutel_input_event(_camera, event, _position, _normal, _shape_idx): diff --git a/Scripts/lichtkastje.gd b/Scripts/lichtkastje.gd index 0d56277..489ed82 100644 --- a/Scripts/lichtkastje.gd +++ b/Scripts/lichtkastje.gd @@ -13,6 +13,7 @@ func _on_lock_input_event(_camera, event, _position, _normal, _shape_idx): if get_node("../Player").has_key: $Deur.visible = false $Lock.visible = false + $Lock/DeurOpen.playing = true func _on_lever_input_event(_camera, event, _position, _normal, _shape_idx):