Let's create a Trigger that plays a sound when something passes through it. For this example, we'll place the sound as a child of the Trigger so we can quickly find it. You can set a node as a child of another node by rearranging by dragging and dropping items via the Hierarchy Panel. Here's the code to play the sound:
function Trigger:onEnter(obj) sound = self:findNodeByName("Sound") sound:play() end
Comments
0 comments
Please sign in to leave a comment.