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.

Newcomers DBPro Corner / Can you hold down a key and make a sound loop?

Author
Message
Banjo
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 20th Jul 2005 03:26
I don't understand how to do this right now. In DB Pro I've loaded my sound. I'm trying this for a gun and then for footsteps, but let's do the gun first. When you click the mouse once, it plays the gunshot once and fires one bullet. But what about if I hold the mouse button down? It shoots multiple bullets correctly, but the sound just keeps starting over and never finishes playing until I let go of the mouse, and it basically sounds like a high pitch buzz because it keeps playing the beginning over and over. How can I make it so that when I hold the mouse button down, the sound will play over and over the full length each time, and not the first millisecond of it and then play that section again and again?

And for footsteps, I have it where the WASD keys move you around, but I also want footstep sounds. I've loaded my sound in and if I tap one of the keys, the footstep sound will play just once like it should. But if I hold one of the keys down to actually move somewhere, nothing plays until I let go of the key and it'll play the footstep once. How can I make it so that when you hold the key down, the footsteps loop through and then stop when you stop holding it down? Thanks.
warship45
20
Years of Service
User Offline
Joined: 24th Jul 2004
Location: uk
Posted: 20th Jul 2005 05:15
ok well for the gun the best way for doing this would be to use the commard sound playing



i think that it is mostly going to be best to use this for the steps and the gun.

hope this was helpfull

simon;

want to join a good dark basic forum then go to

http://www.phpbbplanet.com/forum/index.php?mforum=teamdarkstep
Banjo
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 20th Jul 2005 05:47
Yeah, one minute after posting this I found a thread from the search (took forever to find though) and I figured out how to do it.

I just have

if mouseclick()=1 and sound playing(1)=0
play sound 1
endif

Thanks
James Morgan
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 20th Jul 2005 08:25
Without seing your code, it looks like you are playing the footset after a key has been pressed, or possibly the first milisecond of the sound is silient, so as with your gun it is just replaying that silence over and over until the last time.

First of all, look at Simons code and introduce the method to your footsteps as well as your gun. Hopefully this will solve the footstep problem.

Hello!

Login to post a reply

Server time is: 2024-09-23 23:29:10
Your offset time is: 2024-09-23 23:29:10