How do I play sound when player near to an object

Get help using Construct 2

Post » Sun Jun 07, 2015 7:44 am

So i want put some objects like ghost , skeleton and want to play scare sounds when player is near to these..
How do i make that?
B
4
Posts: 27
Reputation: 254

Post » Sun Jun 07, 2015 9:36 am

Make a blank sprite and pin to your object like a ghost, size of the blank sprite must bigger than the real object. When player hit the blank sprite, you can use collison and play the sounds
B
36
S
13
G
1
Posts: 88
Reputation: 3,101

Post » Sun Jun 07, 2015 5:38 pm

Simpler way is to use the distance function.

Event:
System --> Compare two values --> distance(player.X, player.Y, ghost.X, ghost.Y) < 500

Action:
Play Audio "oOOOoOH.mp3" or whatever that is.

The distance function above measures the distance in pixels, and you can change that 500 to how much closer you want it to activate the sound.
B
10
S
2
Posts: 109
Reputation: 982


Return to How do I....?

Who is online

Users browsing this forum: dop2000, irina, Yahoo [Bot] and 7 guests