Implement tape scene

This commit is contained in:
Matteo Tietz 2024-04-20 18:02:17 +02:00
parent d71779ab5c
commit db19815c2f
5 changed files with 59 additions and 13 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=2]
[gd_scene load_steps=13 format=2]
[ext_resource path="res://3d_platforma/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://3d_platforma/golden_bay_512.hdr" type="Texture" id=2]
@ -8,6 +8,7 @@
[ext_resource path="res://scripts/Library/Actions/TriggerOnReady.gd" type="Script" id=6]
[ext_resource path="res://scripts/Library/Actions/ActionList.gd" type="Script" id=7]
[ext_resource path="res://scripts/Library/Actions/SFX BlackTiger.wav" type="AudioStream" id=8]
[ext_resource path="res://Tape/Tape.tscn" type="PackedScene" id=9]
[sub_resource type="SpatialMaterial" id=36]
resource_name = "CheckerGrid"
@ -81,3 +82,6 @@ script = ExtResource( 1 )
[node name="PlaySound2" type="Node" parent="ActionList"]
script = ExtResource( 1 )
[node name="Tape" parent="." instance=ExtResource( 9 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.1894 )

View File

@ -1,3 +1,26 @@
[gd_scene format=2]
[gd_scene load_steps=5 format=2]
[node name="Spatial" type="Spatial"]
[ext_resource path="res://Tape/tape.obj" type="ArrayMesh" id=1]
[ext_resource path="res://scripts/Library/Actions/TriggerOnCollision.gd" type="Script" id=2]
[ext_resource path="res://scripts/Library/Actions/PlaySound.gd" type="Script" id=3]
[sub_resource type="BoxShape" id=1]
[node name="Tape" type="Spatial"]
[node name="MeshInstance" type="MeshInstance" parent="."]
mesh = ExtResource( 1 )
[node name="Area" type="Area" parent="."]
[node name="CollisionShape" type="CollisionShape" parent="Area"]
transform = Transform( 0.240864, 0, 0, 0, 1, 0, 0, 0, 1.66505, 0, 0, 0 )
shape = SubResource( 1 )
[node name="TriggerOnCollision" type="Node" parent="Area"]
script = ExtResource( 2 )
collision_area = NodePath("..")
action = NodePath("../PlaySound")
[node name="PlaySound" type="Node" parent="Area"]
script = ExtResource( 3 )

View File

@ -19,16 +19,26 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://scripts/Library/Actions/ActionList.gd"
}, {
"base": "Node",
"class": "MusicChangedSlowAction",
"language": "GDScript",
"path": "res://scripts/TriggerOnMusicChangedSlow.gd"
}, {
"base": "Action",
"class": "PlaySound",
"language": "GDScript",
"path": "res://scripts/Library/Actions/PlaySound.gd"
}, {
"base": "Action",
"class": "SetFastMusic",
"language": "GDScript",
"path": "res://scripts/SetFastMusic.gd"
}, {
"base": "Action",
"class": "SetNormalMusic",
"language": "GDScript",
"path": "res://scripts/SetNormalMusic.gd"
}, {
"base": "Action",
"class": "SetSlowMusic",
"language": "GDScript",
"path": "res://scripts/SetSlowMusic.gd"
}, {
"base": "Node",
"class": "TriggerBase",
"language": "GDScript",
@ -47,8 +57,10 @@ _global_script_classes=[ {
_global_script_class_icons={
"Action": "",
"ActionList": "",
"MusicChangedSlowAction": "",
"PlaySound": "",
"SetFastMusic": "",
"SetNormalMusic": "",
"SetSlowMusic": "",
"TriggerBase": "",
"TriggerOnCollision": "",
"TriggerOnReady": ""
@ -60,6 +72,10 @@ config/name="first_anniversary_godot_jam"
run/main_scene="res://3d_platforma/Level.tscn"
config/icon="res://icon.png"
[autoload]
MusicSingleton="*res://scripts/MusicSingleton.gd"
[display]
window/size/width=480

View File

@ -8,5 +8,6 @@ func _ready():
func onTrigger():
get_node( audioStreamPlayer ).play()
print("OnTrigger PlaySound")
# get_node( audioStreamPlayer ).play()

View File

@ -1,9 +1,11 @@
class_name TriggerOnCollision extends TriggerBase
export(NodePath) var collision_area
export(NodePath) var action
func _ready():
collision_area.connect("body_entered", self, "_on_body_entered")
get_node(collision_area).connect("body_entered", self, "_on_body_entered")
func _on_body_entered(body: Node):
triggerAction(body)
func _on_body_entered(_body: Node):
print("Collision action triggered")
triggerNodePath(action)