• Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!

End Step does not assign value (solved)

Misty

Member
I'm stumped

So, my code is like

if collision_point()>0
{
audio_play()
}
else
{
myVar=3 instance_create(100,100,debug)
}

if myVar==3 instance_create(120,100,debug)

And I run the game at 1 fps, and the debugs are not being created at the same time, but one after the other. I tried this in GMS2 also.
 
Last edited:

curato

Member
Is this supposed to be an if statement?
Code:
myVar=3 instance_create(100,100,debug)
I am not wrapping my head around what should be happening here or the representing step and end step and the myVar is different in each event?
if those are both indeed if statements then if would help to see the code where myVar is changing since that seems to be the key if I am understanding correctly.
 

Misty

Member
Is this supposed to be an if statement?
Code:
myVar=3 instance_create(100,100,debug)
I am not wrapping my head around what should be happening here or the representing step and end step and the myVar is different in each event?
if those are both indeed if statements then if would help to see the code where myVar is changing since that seems to be the key if I am understanding correctly.
All of the code occurs in the same codeblock. The code checks if a collision occurs, if not, sets the myVar to 3.

Then, according to me, the code should then create a 2nd instance, after checking if myVar is 3. But instead, it does not recognize myVar has been set to 3 until the next frame, so the 2nd debug draw has a delay. It behaves as if some kind of break statement was put in the code, but I quadruple checked my code many times and there is no break statement or anything.
 
Top