GameMaker Studio 2 – The Basics of Collisions Beginner Tutorial

23
3



Collisions are essential in creating a game, as they’re used for so many different things.
In this video, I’ll walk you through the simple collisions that GMS 2 has, and show you how to use some of them as well.

Social:
– Connect with me on Twitter @Aaron_LLTT:
– Become a valued Patron and receive more exclusive content @:
– Wanna hear from other developers in the industry? Head on over to my podcast, DevTalk, to listen to engaging conversations I have with various successful developers:

My Exclusive Courses💻🎮:
Bundle Course Package & More Here!

Nguồn: https://campaignforcivilrights.org/

Xem thêm bài viết khác: https://campaignforcivilrights.org/game/

23 COMMENTS

  1. After I added the place_free functions into the controls, for some reason the player character doesn't move at all anymore. What might've gone wrong?

    The code looks exactly the same too:
    if keyboard_check(ord("W") && place_free(x, y – collision_speed)){
    y -= moving_speed;
    }
    if keyboard_check(ord("A") && place_free(x – collision_speed, y)){
    x -= moving_speed;
    }
    if keyboard_check(ord("S") && place_free(x, y + collision_speed)){
    y += moving_speed;
    }
    if keyboard_check(ord("D") && place_free(x + collision_speed, y)){
    x += moving_speed;
    }

  2. I have an issue with the animation, actually! If I collide with a wall now, and I hold left after holding up, I'll be stuck to the object and the animation will continue playing for walking left, so, it looks like my character is walking in place. I watched to the end, also. I'm not sure what's wrong.

    Cheers though.

  3. Do you have any idea why it might have the collision only stick when I'm going to the left?

    This is what my collision code looks like:

    if(keyboard_check(vk_left) && place_free(x – collisionSpeed, y))
    {
    x -= walkSpeed;
    image_speed = walkSpeed/3;
    sprite_index = spr_SaraWalkLeft;
    }

  4. Thanks! I'm using a tile collision system, but your suggestion to check a bit ahead of where the player is moving fixed the spastic shaking when coming into contact with a wall.

  5. Okay so, if i start a project up thats gml and just put a collision with the wall and the player, the player stops like it should, but if it's dnd (which is the one im using) it doesnt stop the player. Does it only work on gml?

  6. This doesn't work at all,
    I have the character set to solid, and the wall set to solid, but my character moves right through it
    I tried making the movement using jump to point, and then I changed it to speed movement, but the character still moves through it.

  7. when the player walks up or down into the wall, it works perfectly. but when the player walks left or right into the wall, it goes halfway through the wall and gets stuck. help?

  8. uhh… I made a new object, made both the player object and the new object solid, and created a collision event and it didn't work

  9. help?
    my collisions aren't exact
    the objects always have a lot of distance between them though i have collision speed + 1

  10. h thanks to teach us how use the game maker. I liked ask if is possible. well first I like tell my history. I create a NPC and a path to her and I create a caracter male (this caracter I use button), but when I touch the NPC he's stuck. can you help how resolve this trouble? thanks.

  11. I'm currently having 2 problems. First one is where if I'm holding down, my character can move straight through the objects. And the second one is if I hold right, my character stops about Midway through the screen and can't continue even though there isn't anything there. Any ideas on what may be wrong?

  12. How do you place a line of blocks instead of just placing them one by one? I know it might sound simple but I’m just getting into this stuff.

  13. Sorry to bother, but do you by any chance know how to fix something when my character runs into a wall and is stuck completely?

  14. I know I'm posting this really late, relative to the video, but how come my sprite doesnt work for the simple collisions
    and I copied down the same exact code word for word? Has something changed since gm2 2017 and gm2 2019?

LEAVE A REPLY

Please enter your comment!
Please enter your name here