Mail Archives: djgpp/1997/12/22/02:02:39
Klaas wrote:
>
> > My problem is that a lot of events happen, some on the visible area of
> > the screen, some others not visible.
> > In case of an event how can I decide if I must play the according
> > soundeffect (depending on the position of the vehicle in relation to the
> > visible area)
>
[...]
> well, most games just play the sound at a certain loudness if the event
> is on the screen, and very faintly otherwise (example: Z) Though, I
> suppose teh volume could be scaled using pythagorean distance:
>
> sqr((ObjX-CurX)^2 + (ObjY-CurY)^2) (where CurX/Y are player's position)
> then scale that value from your lowest desired volume to your highest,
> then
> to compute final volume, subtract it from highest desired volume.
Hmm. I think you can drop the sqrt(). The power of a soundwave
decreases in a 2d world proportional to distance^2, so scaling
with 1/r^2 should be OK. But then again, I never really thought
about that.
-
Ciao
Tom
*************************************************************
* Thomas Demmer *
* Lehrstuhl fuer Stroemungsmechanik *
* Ruhr-Uni-Bochum *
* Universitaetsstr. 150 *
* D-44780 Bochum *
* Tel: +49 234 700 6434 *
* Fax: +49 234 709 4162 *
* http://www.lstm.ruhr-uni-bochum.de/~demmer *
*************************************************************
- Raw text -