Difference between revisions of "How to Keep Your gTheSoundFX from iInterupting gTheMusic"

From SCI Wiki
Jump to navigationJump to search
Line 4: Line 4:
 
[[SCI Tutorials]]
 
[[SCI Tutorials]]
 
[[SCI Tutorials and Guides]]
 
[[SCI Tutorials and Guides]]
'''By Cloudee1'''
+
 
 +
 
 +
<div align="center"><span style="font-size: 22pt">How to Keep Your gTheSoundFX from iInterupting gTheMusic</span><br />
 +
'''By Cloudee1'''</div>
 +
 
 +
<br />
 +
==<br /> Introduction ==
  
 
In the first room of my game has music playing as well as a repetitive SoundFX (water dripping) and every time it played it interfered with the music. First I tried playing around with a priority property, but nothing ever really came of that. Then I figured I would just make a timer and count down to when the music should be over but I didn't want to add any more than necessary to my main script. It turns out that both instances have a state property built in. Then it just became a matter of checking for 0.
 
In the first room of my game has music playing as well as a repetitive SoundFX (water dripping) and every time it played it interfered with the music. First I tried playing around with a priority property, but nothing ever really came of that. Then I figured I would just make a timer and count down to when the music should be over but I didn't want to add any more than necessary to my main script. It turns out that both instances have a state property built in. Then it just became a matter of checking for 0.

Revision as of 16:33, 2 April 2025

SCI Tutorials SCI Tutorials and Guides


How to Keep Your gTheSoundFX from iInterupting gTheMusic
By Cloudee1



Introduction

In the first room of my game has music playing as well as a repetitive SoundFX (water dripping) and every time it played it interfered with the music. First I tried playing around with a priority property, but nothing ever really came of that. Then I figured I would just make a timer and count down to when the music should be over but I didn't want to add any more than necessary to my main script. It turns out that both instances have a state property built in. Then it just became a matter of checking for 0.

Code:
(if(== (send gTheMusic:state()) 0) (send gTheSoundFX:number(15)loop(1)play()))

With this the soundfFX will no longer play until after the music has finished.