Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Finish Line

Author
Message
DB newbie
19
Years of Service
User Offline
Joined: 13th Nov 2005
Location: um..... i dont remember.
Posted: 8th Jan 2008 15:39
ok i think i have an idea for my maze gameon how to end it when you get to the finish..it will play a soundwhen you come into contact with it let em know if this will work.

thanks




Come see the WIP!

Robert The Robot
18
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 8th Jan 2008 17:02 Edited at: 8th Jan 2008 17:02
It will work, but it'll start playing the sound again and again.

Every time the main loop is completed, it will check for the object hit and (depending on your code) probably register a collision. It will then start playing sound two. Again. And Again. And again...

This bit of code should ensure that the sound is only played once.


If the sound is already playing, then the program is not allowed to start playing it again!

Hope this helps!

On our way 'ome, on our way 'ome!
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 8th Jan 2008 19:27
you don't need the then at the end of that line. Also this will play the sound again as soon as it's finished... If you just want it once, then add another variable in, like so;


this has also removed the need for the Sound Playing check as after it first starts playing it won't play that sound again. Obviously if you started a new game you'd have to reset the endsoundplayed variable again.

"A West Texas girl, just like me"
-Bush
DB newbie
19
Years of Service
User Offline
Joined: 13th Nov 2005
Location: um..... i dont remember.
Posted: 9th Jan 2008 00:25
thank you for this i swas jsut checking everything.


Come see the WIP!

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Jan 2008 14:23
Demon's Breath is right
the extra variable is called a flag

Login to post a reply

Server time is: 2025-06-02 09:50:09
Your offset time is: 2025-06-02 09:50:09