A link to the past sliding

Discussion in 'Game Design, Development And Publishing' started by Tonydaderp, Sep 22, 2016.

  1. Tonydaderp

    Tonydaderp Member

    Joined:
    Sep 7, 2016
    Posts:
    120
    Okay. hi. I've always been wondering if it was possible and if so, how to program sliding.
    What I mean is in an rpg, Such as a link to the past, if you collide to the very edge of a wall, You slide;(depending on direction, if you collided with the far left, you'd slide a little more to the left, etc)
    I think this enhances gameplay to be a little smoother, as if your collision mask is a tiny bit bigger than the actual sprite, and you collide just enough so that you look like your not even colliding, if you know what I mean.
    Can anyone help? The code for sliding of walls... like in Zelda : a link to the past?
    plz help.
     
  2. Meowmere

    Meowmere Guest

    like pushing objects? or where you'd have a push animation?
    but yes, whatever it is, it can be made in GM:S which sounds relatively simple. I never played lttp (it's so ugly :| ) I played Minish Cap though.
     
  3. Phil Strahl

    Phil Strahl Member

    Joined:
    Jul 3, 2016
    Posts:
    381
    I'm re-playing A Link to the Past right now on my 3DS, but I don't think I quite get what you're referring to. Got an example, screenshot, GIF, video, anything?
     
  4. shadowspear1

    shadowspear1 Member

    Joined:
    Jul 4, 2016
    Posts:
    125
    He means the "smooth-collision" effect where you would normally run into the last few pixels of a wall that don't look like they would stop you, but instead you sort of shift around the collision and are now hugging the wall.
    You could probably accomplish this by using place_free upon colliding with a wall.
    Pseudo-code:
    Code:
    if (COLLISION WITH OBJECT) {
    
        if (DIRECTION == RIGHT) {
            //we collided with a wall on the right, so check up and down for empty locations
            if (place_free(x, y-DISTANCE, OBJ_COLLIDE)) {
                y -= DISTANCE; //move the character up to avoid the wall
            } else if (place_free(x, y+DISTANCE, OBJ_COLLIDE)) {
                 y += DISTANCE;
            }
        }
    
    }
    Obviously this won't work in its current state, but you should get an idea about how to go about doing it
     
    Phil Strahl likes this.
  5. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    783
  6. shadowspear1

    shadowspear1 Member

    Joined:
    Jul 4, 2016
    Posts:
    125
    Just wanna say, that Zelda fan game looks totally awesome. Awesome job with that! :p
     
  7. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    783
    Thanks! If you are interested, I opened the source when I abandoned it if you are curious. (Honestly not even sure it will build in the latest studio...)
     
  8. I found an article last year talking about this exact thing. It's hard to notice it while playing LttP, it feels so natural. I made a couple movement engines with this feature, tons of fun to build. :D
     
    Tonydaderp likes this.
  9. Tonydaderp

    Tonydaderp Member

    Joined:
    Sep 7, 2016
    Posts:
    120
    Thanks! just what I wanted!
     
  10. Tonydaderp

    Tonydaderp Member

    Joined:
    Sep 7, 2016
    Posts:
    120
    Thanks! Really big help! you rock!
     
  11. Tonydaderp

    Tonydaderp Member

    Joined:
    Sep 7, 2016
    Posts:
    120

    Thanks, but there is one thing. I have tested it out and it works GODly, but the player does not move depending if the left or right is free. it is actually if the player collides with(example)the top left quadrant, he moves left by like 2 pixels. Else
    if he collides withthe top right quadrant, he moves right by like 2 pixels.
    This might sound easy, but I do know that you cant specify which quadrant you collide with.

    I could just have 4 objects for each quadrants, but I was wondering if it was possible to do something about it without making more objects. thanks! Also, don't worry about if you collide in the center while touching two quadrants, because in the original zelda 3 that also happens if your in the center.

    Wait! I have an idea.. can you maybe do a grid check... to separate into quadrants
    ...
     
    Last edited: Sep 24, 2016
  12. Tonydaderp

    Tonydaderp Member

    Joined:
    Sep 7, 2016
    Posts:
    120
    But if you cant figure out something, thanks a lot anyways!;)
     
  13. Tonydaderp

    Tonydaderp Member

    Joined:
    Sep 7, 2016
    Posts:
    120
    I
    actually I'm also making a zelda a link to the past fan game. Thx also.
     

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