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?
Develop games in your browser. Powerful, performant & highly capable.
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
Simpler way is to use the distance function.
System --> Compare two values --> distance(player.X, player.Y, ghost.X, ghost.Y) < 500
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.