How Collisions Work in GameMaker Studio 2

Поділитися
Вставка
  • Опубліковано 28 лют 2021
  • Basics of Collisions in Game Maker Studio 2
    In almost every game, you'll need some sort of collision checking. Today, let's tackle basic collisions using place_meeting, collision masks, and while loops. We'll create a great system for use in prototypes and final games with just a little bit of code!
    My Exclusive Courses💻🎮:
    - Bundle Course Package & More Here! www.letslearnthistogether.com...
    Game Dev In 30 Days 📖 💻😀
    - I'm really excited to announce that I am writing a game development book for beginners!
    - I am deeply motivated and invested into making this an awesome fun book for beginners interested in learning game development!
    - Click the link to our KickStarter for more details! www.kickstarter.com/projects/...
    Social:
    - Connect with me on Twitter @Aaron_LLTT: / aaron_lltt
    - Become a valued Patron and receive more exclusive perks @: / letslearnthistogether
    - 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: devtalk.buzzsprout.com/
    - Now on Instagram 📸! Follow here for more content and sneak peaks! / letslearnthistogether

КОМЕНТАРІ • 22

  • @thebreadenjoyer6057
    @thebreadenjoyer6057 Рік тому +2

    This video is so underrated. This is the only wall collision video that I have found that actually works and makes sense. I'm a complete beginner to all of this and your videos are really helping me.

  • @chadcoyle
    @chadcoyle 3 роки тому +14

    I understand this kind of basic collision well, but for the more advanced video(s), I'd love to understand how to code things like jump-through slopes and platforms that rotate dynamically while the player is standing on them. Great video covering this as it is!

  • @burnoMello
    @burnoMello 5 місяців тому

    Saved my life, man. I am a beginner dev trying to figure out collisions and a bunch of other physics problems and this tutorial was clean, easy to follow. Thank you so much.

  • @Joxlol
    @Joxlol 8 місяців тому +1

    Man, you can't believe how long I struggled to find a solution for my collision (it were like 2 hours today, but I like to move fast forward). Thanks a lot, well explained, much appreciated!!!

  • @papercut5238
    @papercut5238 7 місяців тому

    Not sure if you're still active here, but wonderful tutorial! Although, I can't seem to figure out how to get diagonal collision working for the life of me.

  • @light9808
    @light9808 2 роки тому +2

    Great video!

  • @Vampiric_Kai
    @Vampiric_Kai 3 роки тому +1

    I love your gamemaker tutorials

  • @mopspear
    @mopspear 19 днів тому

    I found this to be really helpful but I want to suggest a change. Instead of using a while loop, I found that using a for loop that runs some arbitrary number of times is a better idea. It won't lock up if the collision suddenly become impossible, or you did something wrong with your code so that the while loop never completes. With a for loop, the worst that can happen is the collision doesn't completely touch what it is supposed to. It's better than being locked. I avoid using while loops whenever I can.

  • @Starmanstriker
    @Starmanstriker 3 роки тому +4

    How would you go about smooth collision? Like sliding against a diagonal from any direction or custom shapes.

    • @LetsLearnThisTogether
      @LetsLearnThisTogether  3 роки тому +2

      If you add a few more while loops to check for both x and y speed increase, that will take care of diagonal. Custom shapes can be done by setting the collision of objSolid sprite to precise per frame, and then add more sub frames of those specific shapes.

  • @SGTIvan921
    @SGTIvan921 6 місяців тому

    Timestamp Reference:
    10:26 Getting stuck phenomenon (Cause of it: Collision mask changing since the sprites are different when you face a different direction)
    11:26 The solution
    12:18 Making the character go up to the wall instead of stopping weirdly

  • @lytningthief
    @lytningthief 2 роки тому +2

    Hi! So I use the same collision code you taught here but I'm having some difficulty with what I believe is called "Sub-Pixels." Basically when my character lands on collision blocks there's either a teensy bit of space between him and the block (not a full pixel) or his feet have sunk into the ground by roughly the same amount. It's not enough to get him stuck or anything but it seems to be interfering with sprite changes that require pixel perfect collisions. Any idea how to fix this?

  • @jhmxk
    @jhmxk Рік тому

    how would this change if the direction your character is facing is controlled by your mouse?

  • @cronical246
    @cronical246 3 роки тому +1

    How would this work if I use set direction instead?

    • @LetsLearnThisTogether
      @LetsLearnThisTogether  3 роки тому

      Same idea. Just calculate where you’re moving based on speed and direction.

  • @cactus7022
    @cactus7022 Рік тому

    I know it's been a long time, but...
    if I want the character's sprite to be above the table when he's in front of it, but when he's behind the table, then the character's sprite would be behind the table's one. How to do it?

    • @LetsLearnThisTogether
      @LetsLearnThisTogether  Рік тому +1

      You’ll need to change the depth of your player as they move. I believe the traditional and easiest approach is depth = -y, and apply that to every object in your game. Then the player will appear in front when they’re below it, and behind when they’re above.

  • @coxyofnewp
    @coxyofnewp 3 роки тому

    What happened to video you posted yesterday and now it private? Keep up the great content.

  • @MACnTOOL
    @MACnTOOL 3 роки тому

    "it sounds like i am beat-boxing but i am not"