• 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!

Legacy GM When this, skip the next ?

N

NoFontNL

Guest
Hi. I have a quick question, this is my code:
Code:
if (!place_meeting(x+sign(hsp),y-8,par_ground) && !place_meeting(x+sign(hsp),y-8,obj_pipe)) {
        with (obj_oneway) {
            if (place_meeting(x-sign(other.hsp),y+8,other)) {
                if !(bbox_top > other.bbox_bottom) {
                    other.dir = other.dir*-1;
                }
            }
        }
        with (obj_brick) {
            if (!place_meeting(x-sign(other.hsp),y+8,other)) {
                if (jumped) {
                    other.dir = other.dir*-1;
                }
            } 
        }
       // dir = dir * -1;
    }
I want it if the dir variable got changed in one of the with statements, that then it don't change the dir variable again and only change it, when the with statements didn't. Also I'm trying to if (for example) the with (obj_oneway) changed the dir variable, then don't change it in the with (obj_brick) statement.

If it isn't clear, here you have another explanation:

Intention: Skip the rest of the if statement (but not the rest of the code) if the dir variable got changed once.

How would I do that? Is there a special function for or something else?
 

Slyddar

Member
Just create a local variables set to false. Change it to true if you change the dir in the if and with functions. Then at the end you only change the dir if that variable is still set to false.
 
Top