End Step does not assign value (solved)

Discussion in 'Programming' started by Misty, Sep 9, 2019.

  1. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    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: Sep 9, 2019
  2. curato

    curato Member

    Joined:
    Jun 30, 2016
    Posts:
    379
    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.
     
  3. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    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.
     
  4. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    nvm, it was a code bracket issue, solved
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice