• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Animation playing AFTER the sound file

C

Cartoonicus

Guest
This is the most bizarre situation.

I have an animation I want to play as long as a certain sound file is playing. Let me see if I can explain my programming in D&D.

Create Event:
Assign Variable: radio_channel = 0
Set Animation Speed = 0
Set Sprite: anim_radio = 1

Step Event:
If audio is playing: snd_radio0
Set Animation Speed = 1
Set Sprite: anim_radio = 1
-
Else:
Set Animation Speed = 0
Set Sprite: anim_radio = 1

Left Released:
If Variable: radio_channel is = 0
Play Audio: snd_radio0

(The reason I'm doing this in variables is because I want to end up with multiple sound files that will play in order)

So you see, when the player clicks on a button, if the variable: "radio_channel" is zero, the audio file "snd_radio0" should play from start to finish. Then in the step event, if the audio file "snd_radio0" is playing the animation: "anim_radio" should play and loop as long as "snd_radio0" is playing, then stop. However, instead the animation waits until the audio file has completely finished playing, to start, then loops forever.

What the heck am I missing?

What order does a step event happen in relation to a mouse click. I have an audio file that playson a mouse release and an animation that's supposed to play when the step event asks if the Audio file is playing but instead the entire sound file plays and THEN the animation starts.
 

TsukaYuriko

☄️
Forum Staff
Moderator
(I merged your reply to another topic into this one - please don't resurrect years old topics and please keep your own questions contained in your own topics.)

The order in which events happen is partially documented on the Object Events manual page. The relation between Step and Mouse events is not outlined there, so it is undefined and may take on any shape or form. You can therefore not rely on it.


Make sure you're properly nesting your code. An if statement, by default, only encapsulates the following action. If you want multiple actions to depend on it, they need to be in a block.
 
Top