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 / sound problem...please help

Author
Message
DRYAD
22
Years of Service
User Offline
Joined: 20th Dec 2002
Location: Greece
Posted: 7th Feb 2003 19:48
i have a big problem.
read the code above
the sound i loaded i want to play only once
but it plays a very very fast loop.
i just want it to play onny once..
please help me

load image "background.bmp",2
load sound "lasergun.wav",1
rem putting background
paste image 2,0,0
rem loading sprites for gui
load bitmap "buttons.bmp",1
get image 1,0,0,130,100
rem coordinates for gui graphics
gui1x=0
rem main loop for gui
sync on
do
play sound 1
gui1x=gui1x+15
sprite 1,gui1x,150,1
if gui1x>=250
gui1x=250
stop sound 1
endif
sync
loop


please help me...
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 8th Feb 2003 05:38
move it out of your main loop

or place it in a conditional if statement or something similar that changes a variable up by one then detects that its lesser than 1 to know its been played once

DRYAD
22
Years of Service
User Offline
Joined: 20th Dec 2002
Location: Greece
Posted: 8th Feb 2003 09:48
can u make an example? please
thanks in advance

freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 8th Feb 2003 11:56
this is how you did it:



as you know, you placed the play sound command in your main loop (between the do and loop tags)

how you have to do it if you want to play it only once when the loop starts:



indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 8th Feb 2003 15:37
oops someone beat me back here.

o well heres another to look at




indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 8th Feb 2003 15:38
press a and s to seee the difference if thats not apparant and save it in a folder with a project and a wav file then change the name accordingly at the top.

Login to post a reply

Server time is: 2025-05-12 02:27:53
Your offset time is: 2025-05-12 02:27:53