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 / Movement and Sound

Author
Message
I Code Therefore I Am
22
Years of Service
User Offline
Joined: 26th Apr 2003
Location:
Posted: 30th Apr 2003 03:51
I am trying to get this sound to play whenever I walk with the arrow keys. It works, but it doesn't finish the sound after I've moved. Instead it plays it repeatedly until I stop.

Load Sound "Step.wav" ,1
Load Sound "Step.wav" ,10 : Set Sound Volume 10,50

IF UpKey()=1
IF UpKey() then Play Sound 1
XTest# = NewXValue(X#,CameraAngleY#,100)
ZTest# = NewZValue(Z#,CameraAngleY#,100)
IF XTest#>0 and XTest#0 and ZTest#
I Code Therefore I Am
22
Years of Service
User Offline
Joined: 26th Apr 2003
Location:
Posted: 30th Apr 2003 04:01 Edited at: 30th Apr 2003 07:59
I'm trying to make a first person view, or if I have no choice a third person view.

Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 30th Apr 2003 07:09
That's some pretty strange code . Nowhere in there do you play sound 10. You need to set different times at which you'll play each sound. You'll need a counter for the left foor and for the right foot. As you move forward, the counters increments based on your speed. Once you get past the limit for a given foot, the sound will play and that counter will be reset to 0.
I Code Therefore I Am
22
Years of Service
User Offline
Joined: 26th Apr 2003
Location:
Posted: 30th Apr 2003 07:36 Edited at: 2nd May 2003 05:30
Thanks for your reply. I am new to dark basic and I just started to figure out little things by copying and pasting code into the program. I don't really understand what you mean.. All these numbers are a tad complex for me to input.

Danmatsuma
22
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 30th Apr 2003 08:17
The way I do it is to use 'set object frame' instead of the 'loop/play object' commands. That way you know exactly which frame your animation is at, and for instance you can play a footstep sound on the precise frames where a foot connects with the ground

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 30th Apr 2003 08:50
Ah good idea . I didn't even think of that. But if you don't have a model which does so (like in a FPS), you'd have to use 1 (or 2) counter(s).
matt rochon
22
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 30th Apr 2003 15:08 Edited at: 30th Apr 2003 15:11
just count the frames and whenever th frame is equal to one of the step animations, then play the sound

dunno if someone already said that
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 30th Apr 2003 22:42


Will that work?

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 1st May 2003 01:01 Edited at: 1st May 2003 01:01
Yes and no. It will "work" but it won't adjust the frequency of the footsteps. I will sound like rapid running (for example) regardless of if you're running or just crawling.
Danmatsuma
22
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 1st May 2003 16:19
Ok here you go


speed# is the speed of the animation

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
I Code Therefore I Am
22
Years of Service
User Offline
Joined: 26th Apr 2003
Location:
Posted: 1st May 2003 18:33
Thank you all for your help. I'm going to try it out and see how it works.

Login to post a reply

Server time is: 2025-05-17 18:43:14
Your offset time is: 2025-05-17 18:43:14