Play sound when enemy is within camera frame
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:
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:
Best Answer
-
calvin9403 Posts: 3,186
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