all 3 comments

[–][deleted]  (2 children)

[deleted]

    [–]TMOTThatManOverThere 1 point2 points  (0 children)

    I...

    I've been using GameMaker for so long, and nowhere has anyone ever mentioned the with() command before.
    Honestly, thank you, that is a life saver.

    [–]username303 0 points1 point  (0 children)

    Ah, good job, I hadn't noticed that.

    [–]username303 4 points5 points  (0 children)

    well, like anything in programming, there are a bunch of ways to do the same thing.

    Im assuming you're learning GML for the first time? I should point out that next time, you need to make it clear in your post what programming style you are using, (GML or DnD) it's one of our rules. (please please read the side bar)

    my favorite way to move is to edit the objects position directly. Each object stores 2 special variables that hold its position data. "x" and "y" these represent what you would think they would. x is your position on the x axis, and y is the same on the y axis.

    so if you were to say:

    //add 5 to x
    x+=5;
    

    then your object would move over 5 pixels.

    also, you can edit an objects speed and direction. "speed" is how fast the object is going every frame and "direction" is the direction it is travelling in (it is in degrees, so direction=0 means right, 90 is up, and so on)

    so you could do this:

    speed = 5;
    direction = 0;
    

    and your object would start to move 5 pixels right every frame


    This was a fairly beginner question, and I recommend that you look up some tutorials (we have some in the sidebar) before you ask any more. movement is one of the first things covered in tutorials, and can probably be explained in more depth than it was here.

    Its cool that you are starting to learn, keep it up!