sound problem

hi mozza here

have an issue with my game i have background music playing on my level but when i add an enemy who appears and laughs using music or sound audio .ogg or .wav the game goes crazy with a horrible sound .

any suggestions

Hi, I’ve deleted the duplicate topic in Bug Reports, try to post it in only one place :wink:

Can you post a screenshot from the events you use to play the laugh (or a simple example that replicate the problem)? Maybe the conditions to play the sound are true for several frames, and one sound is played after other :slight_smile:

I think your action “Play music/sound” is repeated endlessly because your condition(s) is/are always true when your enemy appears. :slight_smile:

Try to add a condition “Trigger once while true” (in Advanced) in your event or a reversed condition “A music/sound is played on canal X” and then an action “Play a music/sound in canal X”. :wink:

But try to explain exactly what conditions and actions you are using and if you can take a screenshot.

thanks for deleting post , thought it might have been a bug also,

The trigger once worked thank you,

as u seem to know what your doing i have another question

i have a boss room where i have the enemy appear and diasapear randomely in the room but he just goes mental and appears everywhere and his animation just stops
any ideas
thanks

We cannot answer with so little informations. Can you take a screenshot of your events ?

What you have to understand in GD is that as long as the conditions of an event are true, all the actions of this event will be repeated. So if your conditions are always true, your game will perform actions again and again. Your computer is very fast (faster than your eyes) and sometimes (for example teleporting a boss randomly) you cannot even see what is going on.

“Trigger once while true” and reversed conditions are very useful to limit these repetitions (you can invert conditions by checking the box at the foot of the window of the condition).

The other way of limiting the instant repetitions of actions is the timer. Simply apply a condition “If timer X is greater than Y seconds” then perform the desired action and add another action “Reset the timer X”. This will perform your action each Y seconds.

In your case, you can do :

This event will be repeated every 1 second. Of course, you can modify this value as you want.
I highly recommend you this event scheme, which is widely used in all GD games.

Concerning the animation, did you clicked the arrow circle in the sprite object window (look at the picture below) ?

If you don’t want a looped animation, you can reset the animation each time your boss is teleported, just add the action “Play the animation of boss” in the event.

ok u seem to have ansawerd my problem here thanks

Im Sorry but can u help me where can i find "Play a sound in canal X ? "