Play sound when enemy is within camera frame

SinSquidSinSquid Member, PRO Posts: 135
edited April 2012 in Working with GS (Mac)
Hi, couldn`t find any answer to this. Is it possible to have an enemy (in this case, some kind of a pigdog) to only make sound when he is visible within the camera frame.

The enemy is placed pretty far away, and I don`t want him to make any sound before the player sees him.

Or even better, can i make the sound getting louder as the player is getting closer and closer?

Here`s a screen:
image

Best Answer

  • calvin9403calvin9403 Posts: 3,186
    Accepted Answer
    first you'll want to constrain your actor's x and y to two attribute(global, real)

    constrain your acotr's x and y to those two attributes

    when enemy'sx is greater or equal to0 and smaller or equal to 320 and enemy'sy is greater or equal to0 and is smaller or equal to480

    play sound

    in the volume

    (magnitude enemy'sx-actor'sx, enemy'sy-actor'sy)/100(you can change the 100 to what ever you like)

    Calvin


Answers

  • SinSquidSinSquid Member, PRO Posts: 135
    Thanx a lot @Calvin9403, this worked fine, and I even put in some volume adjustments. I`m still amazed over the possibilities in gamesalad :)
  • calvin9403calvin9403 Member Posts: 3,186
    No problem, gamesalad is a wonderful tool
Sign In or Register to comment.