1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GMS 2 how does move_wrap work?

Discussion in 'Programming' started by Shadowblitz16, Dec 23, 2018.

  1. Shadowblitz16

    Shadowblitz16 Member

    Jun 23, 2016
    how does move_wrap work?
    like what would it translate into gml?

    I currently have this to wrap at a certain point
    /// @description move_wrap_ext()
    /// @param wrap_x_min
    /// @param wrap_y_min
    /// @param wrap_x_max
    /// @param wrap_y_max
    /// @param hor
    /// @param vert
    /// @param margin
    var w      = argument[2] - argument[0]; 
    var h      = argument[3] - argument[1];
    var ox     = argument[0];
    var oy     = argument[1];
    var hori   = argument[4];
    var vert   = argument[5];
    var margin = argument[6]
    if (hori)
        if      (x < ox-margin) x+=w;
        else if (x >  w+margin) x-=w;
    if (vert)
        if      (y < oy-margin) y+=h;
        else if (y >  h+margin) y-=h;
  2. TheouAegis

    TheouAegis Member

    Jul 3, 2016
    You take the x coordinate, check if it's less than the minimum plus the margin, if it is, you set it to the maximum. ELSE if it's greater than the maximum minus the margin, set it to the minimum. Then do the same for y.

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