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 / sound problem

Author
Message
cfender
17
Years of Service
User Offline
Joined: 16th Mar 2007
Location:
Posted: 19th Mar 2007 01:58
Hi i have a problem with a game i am making. I need to play a sound once when a key is held down
for example, if i assign the key H to play a sound, if i hold it down the sound will repeat itself over and over until i let go, i need the sound to only play once no matter how long the key is held down. Have any ideas?

Thanks
Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 19th Mar 2007 03:52
You will need to check the keystate() of the key you want to assign to the sound. The 'H' key is 35. You could use something like this:


If you don't know the scancodes of the keyboard (so you can know what number to plug into the keystate(35) above, you could use the following to find it out:



Just run the program and press the key(s) you want to identify and it will tell you what the scancode is.

You idiots! You've captured their stunt doubles!
cfender
17
Years of Service
User Offline
Joined: 16th Mar 2007
Location:
Posted: 19th Mar 2007 22:20
Thanks alot works perfectly
Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 20th Mar 2007 01:41
Np - glad to help.

You idiots! You've captured their stunt doubles!

Login to post a reply

Server time is: 2024-11-25 22:28:57
Your offset time is: 2024-11-25 22:28:57