diff --git a/3d_platforma/Level.tscn b/3d_platforma/Level.tscn index cdd3b7c..8dd37da 100644 --- a/3d_platforma/Level.tscn +++ b/3d_platforma/Level.tscn @@ -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 ) diff --git a/Tape/Tape.tscn b/Tape/Tape.tscn index 19bd56d..3513b02 100644 --- a/Tape/Tape.tscn +++ b/Tape/Tape.tscn @@ -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 ) diff --git a/project.godot b/project.godot index 9cea6b9..4a94245 100644 --- a/project.godot +++ b/project.godot @@ -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 diff --git a/scripts/Library/Actions/PlaySound.gd b/scripts/Library/Actions/PlaySound.gd index 38077d1..0e95e9f 100644 --- a/scripts/Library/Actions/PlaySound.gd +++ b/scripts/Library/Actions/PlaySound.gd @@ -8,5 +8,6 @@ func _ready(): func onTrigger(): - get_node( audioStreamPlayer ).play() + print("OnTrigger PlaySound") +# get_node( audioStreamPlayer ).play() diff --git a/scripts/Library/Actions/TriggerOnCollision.gd b/scripts/Library/Actions/TriggerOnCollision.gd index 4f03bdb..bf602f4 100644 --- a/scripts/Library/Actions/TriggerOnCollision.gd +++ b/scripts/Library/Actions/TriggerOnCollision.gd @@ -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)