Stop Music

Talk about making games.

Stop Music

Postby Dark RyNo » Fri Feb 25, 2005 9:18 pm

Is there a way to stop music from playing once its started?
I tryed event disable but that didnt work.
Anyone know?
When I switch onto the end of level screen I need the music to stop.
Dark RyNo
 
Posts: 35
Joined: Tue Feb 08, 2005 7:04 pm
Score: 0 Give a positive score

Postby willg101 » Fri Feb 25, 2005 10:12 pm

First of all, you need your music to be a sound.
Create a variable, say, "mysound".
In scrpit editor do this:

Code: Select all
mysound=PlaySound2("<sound file>", 1.000000, 1, 0.000000);

Use stopSound with mysound when you load a level.
Note: you cannot stop any music, only sounds.
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby Dark RyNo » Sat Feb 26, 2005 10:10 am

I cant select my music in th play sound menu.
It must be because of the file extension.
surely there must be a way to stop music!
If not there should be in the next version.
Dark RyNo
 
Posts: 35
Joined: Tue Feb 08, 2005 7:04 pm
Score: 0 Give a positive score

Postby jazz_e_bob » Sat Feb 26, 2005 10:22 am

surely there must be a way to stop music!
If not there should be in the next version.


Use stopSound


You can stop music and sound with stopSound.
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby Dark RyNo » Sat Feb 26, 2005 1:56 pm

I tryed this.
stopSound("LEVEL 1.mid");
it says illegal cast operation.
Dark RyNo
 
Posts: 35
Joined: Tue Feb 08, 2005 7:04 pm
Score: 0 Give a positive score

Postby jazz_e_bob » Sat Feb 26, 2005 8:59 pm

Nah nah nah. :)

Code: Select all
mysound = PlaySound2("<sound file>", 1.000000, 1, 0.000000);


then

Code: Select all
stopsound( mysound );
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby Dark RyNo » Sun Mar 06, 2005 3:51 pm

i tryed that.
It came up like this:
music = PlayMusic2("C:\\Documents and Settings\\Ryan\\My Documents\\Games\\Mario\\data\\LEVEL1.MID", 1.000000, 99, HIGH_PRIORITY_MUSIC);

The pink bits are actually white. You just cant see white on here.
Theres an error in the script.
Im sure those colours cant be correct?
Dark RyNo
 
Posts: 35
Joined: Tue Feb 08, 2005 7:04 pm
Score: 0 Give a positive score

Postby jazz_e_bob » Sun Mar 06, 2005 8:21 pm

OK.

I have taken this example code from a working game. Give it a go.

PLAY
globalMusicChannel = PlayMusic2("data/walkakt1.mid", 1.000000, 335, HIGH_PRIORITY_MUSIC);


STOP
stopSound(globalMusicChannel);
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest