Gamemaker sound
Hey Guys,
I was wondering if maybe you could help me out with some code.
I'm trying to play sound, but only once the object is in the view[0].
Right now every object is play sound all at once and it slows the game down rapidly.
I've tried creating an emitter to play the sound, but as far as I know the sound is still playing in the distance you just can't hear it yet, but still taking up memory.
But I rather have the sounds only play in the view and stop once the leave view.
I can't seem to rap my head around this one.
Any code tips are very welcome!
I was wondering if maybe you could help me out with some code.
I'm trying to play sound, but only once the object is in the view[0].
Right now every object is play sound all at once and it slows the game down rapidly.
I've tried creating an emitter to play the sound, but as far as I know the sound is still playing in the distance you just can't hear it yet, but still taking up memory.
But I rather have the sounds only play in the view and stop once the leave view.
I can't seem to rap my head around this one.
Any code tips are very welcome!
Comments
This also includes ALL code.
It has given the results I wanted. I'll have to instance_deactivate_object(); rather than the instance_deactivate_all();
This is rather a great piece of code, hopefully it will help someone else out in the future :)
Just remember, that if you use instance_deactivate_all(); you have to use
instance_activate_region(left, top, width, height, inside, notme); so once the object/instance reaches the view it will start running it's code and animation.