GameMaker Studio 2: Complete Platformer Tutorial (Part 1: Basics)

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024

Комментарии • 3,6 тыс.

  • @SaraSpalding
    @SaraSpalding  2 года назад +181

    If the collision system in this video no longer works for you, you might need to enable "collision compatibility mode" in Game Options -> Main Options -> General. GameMaker has changed over the years!
    Alternatively, I have released a new 5 minute video that covers all of these basics and is up to date with 2022+ standards: ruclips.net/video/ywgkXbHYJNE/видео.html

    • @sunshinefeon
      @sunshinefeon 2 года назад +2

      I cant find collision compatibility any where. Tried looking up global setting but I couldn't find anything. Can you tell me where this setting is located?

    • @SaraSpalding
      @SaraSpalding  2 года назад +5

      @@sunshinefeon global game settings, main options, general. At the bottom of the page. This is assuming you're using a very recent version of GameMaker.

    • @SaraSpalding
      @SaraSpalding  2 года назад +7

      Noticing now they've changed the IDE and the menu is now called simply "Game Options", represented by the little cogwheel icon on the top bar.

    • @sunshinefeon
      @sunshinefeon 2 года назад

      @@SaraSpalding Ah, ty.

    • @SUBtoMasonman101
      @SUBtoMasonman101 2 года назад +5

      When ever the player falls it gets stuck do you know how to fix that?

  • @josephloos5044
    @josephloos5044 6 лет назад +289

    I can now make a cube move in a very limited space. And it only took me literally from about 3pm to 12am. Feelin proud.

    • @Rickmonas90
      @Rickmonas90 Год назад +4

      wow it took you an entire afternoon

    • @Bue.z64
      @Bue.z64 Год назад +1

      literally me

    • @SparkysTagin
      @SparkysTagin Год назад +5

      nice i can't even get the cube to move lol

    • @SynthGirl64
      @SynthGirl64 10 месяцев назад +1

      @@Rickmonas90 an entire afternoon = 9 hours? I'm making good pace

    • @mahdiaamir3971
      @mahdiaamir3971 9 месяцев назад

      i needed 5 days

  • @KillingSurvival
    @KillingSurvival Год назад +84

    I know you already got a lot of praise for this tutorial but here:
    Your tutorial made coding fun for me (I've been trying to learn for a month)
    Took me about 1.5h to get this done and it's incredible, I'm looking forward to the rest of the series :D
    I will coment on as many videos as I remember so the algarythm hopefully pushes this amazing tutorial to more people looking to code

    • @SaraSpalding
      @SaraSpalding  Год назад +14

      Well done!!

    • @Jmine123
      @Jmine123 Год назад +3

      That is how I feel!

    • @voidymite
      @voidymite Год назад +2

      EXACTLY. i love this tutorial as much as it makes me love sam hogan !!! EXTREME props to him. this helped me learn coding entirely.

  • @m4rt_
    @m4rt_ 6 месяцев назад +2

    Programming tip:
    Avoid abreviations like hsp, vsp, grv, walksp. These can confuse you or others in the future, It's better to spend some extra time to write out a longer name for it, for example:
    horizonatal_speed, vertical_speed, gravity, walk_speed
    Now you will know exactly what every variable is for, so you won't have to guess what it is for. (it may not seam like an issue now, but over time when you have a lot of them, you'll have a hard time remembering what every single variable means, and what the exact name for a variable you need is, when you have ones more like the ones above, you can just write out what the variable is for rather than a code name for it)

  • @vexinity5151
    @vexinity5151 2 года назад +1

    If u want multiple ways of controlling the item use this block:
    key_left = keyboard_check(ord("A")) or keyboard_check(vk_left);
    key_right = keyboard_check(ord("D")) or keyboard_check(vk_right);
    key_jump = keyboard_check_pressed(vk_space) or keyboard_check(ord("W")) or keyboard_check(vk_up);
    this lets the player control the enttiy in many ways.

  • @ZackDaly
    @ZackDaly 4 года назад

    Thank you SO much for this tutorial series! It has been INVALUABLE in my programming education. Keep up the great work!

  • @stefan33uk
    @stefan33uk 3 года назад +1

    This video is delicious! Downloaded GMS2 after realising Unity was overkill for my needs - creating my first 2d platformer for fun. Glad I've chosen your channel as my learning tool right from the beginning!

  • @RobinBli
    @RobinBli 12 дней назад

    Super helpful tutorial. Thank you very much! :)

  • @derDeydrihmOrcsTale
    @derDeydrihmOrcsTale 3 года назад

    awesome tutorial! i did not know anything and now i've learned MUCH.
    and it's moving! and jumping! and I did all of this! yay! =D

  • @EnigmaMan88
    @EnigmaMan88 7 месяцев назад

    This is really cool, thank you for making this series, but I have some questions. For starting from scratch, did you choose blank game or platformer? After that did you choose, GML Code or GML Visual?

  • @lunasoldev
    @lunasoldev 4 года назад +638

    Instructions unclear ended up with a 4D shooter with a battle royale mode

  • @TheHouseton
    @TheHouseton 3 года назад +484

    Create Sprites (Player/Wall) - 0:48
    Create Objects (Player/Wall) - 2:53
    Room Explanation - 3:45
    Placing Objects in Room - 4:19
    Event coding:
    Explanation - 6:26
    oPlayer Create Event Coding - 7:03
    Variable Explanation - 8:17
    oPlayer Step Event Explanation - 11:28
    Step Event Coding (Movement) - 12:50
    Step Event Coding (Local Variable explain) - 15:00
    Step Event Coding (Movement contd) - 17:08
    Game Options FPS setting - 19:15
    Step Event Coding (Collisions Section) - 20:11
    Comment/Description Explanation - 20:52
    Step Event Coding (H Collision code start) -21:40
    Step Event Coding (V Collision code start) - 27:11
    Step Event Coding (V Movement) - 28:56
    Step Event Coding (Jumping) - 29:44
    (Bonus) - 32:05
    if mouse_check_button(mb_middle)
    {
    search_gm2_manual(function currently highlighted);
    }

    • @lasy5159
      @lasy5159 3 года назад +2

      Hey man could you help me
      So my problem is when i put the walls on the same instance as the player in my case a boat is, the walls dont prevent the boat from going through them.
      thanks so much for helping me.
      Heres my script
      // Keybind wasd vk_comands
      keyboard_set_map(ord("W"), vk_up);
      keyboard_set_map(ord("A"), vk_left);
      keyboard_set_map(ord("S"), vk_down);
      keyboard_set_map(ord("D"), vk_right);
      // vk up
      if (keyboard_check(vk_up)) y= y-2;
      // Get player Input
      key_up = keyboard_check(vk_up);
      key_left = keyboard_check(vk_left);
      key_right = keyboard_check(vk_right);
      // calculate movement
      var move = key_right - key_left;
      hsp = move * walk_sp;
      // horizontal collision
      if (place_meeting(y+hsp,y,Owall))
      {
      while (!place_meeting(x+sign(hsp),y,Owall))
      {
      x = x + sign(hsp);
      }
      hsp = 0;
      }
      x = x + hsp;
      i have // vk up because i wanted to move verticaly the keybinds are here for so i can use w a s and d.
      So my problem is when i put the walls on the same instance as the player in my case a boat is, the walls dont prevent the boat from going through them.
      thanks so much for helping me.

    • @dotmbarricade3424
      @dotmbarricade3424 3 года назад

      Thx man

    • @athletica5571
      @athletica5571 3 года назад

      Wow Ur cool

    • @theairacobra
      @theairacobra 2 года назад

      @@lasy5159 while (!place_meeting(x+sign(hsp),y,Owall))
      you put a mayus in o, when it should be oWall

    • @eros.2634
      @eros.2634 2 года назад

      King

  • @toolongdidntstudy8838
    @toolongdidntstudy8838 7 лет назад +669

    I remember 3 years ago I went to learn GameMaker Studio, and Shaun's platformer tutorial was there for me to learn. Now I can produce a platformer on the spot without any references.
    I'm delighted to see that you're producing a tutorial for the people getting into GM:S 2.
    Thanks Shaun.

    • @santripta
      @santripta 7 лет назад +16

      Too Long; Didn't Study
      Can relate, mate, he gets an 8/8.
      (sorry couldn't resist)
      Seriously though,
      Shaun helped me start programming, which led me to get into advanced programming(OO)
      The amount of stuff I learnt on this channel is alot.
      Just checking in to help these people with their errors.

    • @evilerroryt8448
      @evilerroryt8448 7 лет назад +1

      I'm gonna subscribe I'm new to gamemaker studio 2. My friend and I want to make very awesome games for fun and maybe for a bit if cash but mostly for fun I can't wait for more content like this :)

    • @jakob6455
      @jakob6455 7 лет назад

      Hi,
      I have a problem with loading my game...
      it takes me 30 seconds. Do you maybe know what is wrong? The computer is very fast.
      Thank you for great tutorials.

    • @tthomas-mj1iy
      @tthomas-mj1iy 7 лет назад

      Yeah loved his gm tutorials and now im happy to see he did some for gm2 to

    • @nickbrickslegoanimations1042
      @nickbrickslegoanimations1042 6 лет назад

      is Game Maker Studio still available or is it out of service now?

  • @dkipaz3117
    @dkipaz3117 6 лет назад +1728

    Anybody who wants to add A = left and D = right (like the WASD controls) just do this:
    key_left = keyboard_check(ord("A"));
    key_right = keyboard_check(ord("D"));

    • @g1ues
      @g1ues 6 лет назад +26

      thanks bro!

    • @poatatosalad6349
      @poatatosalad6349 5 лет назад +15

      thanks i was looking on how to do it

    • @maxmarohn581
      @maxmarohn581 5 лет назад +6

      i thought it had to be ord('A'), but that was giving me troubles

    • @pat9986
      @pat9986 5 лет назад +18

      From someone who's arrow keys are stupidly tiny compared to the normal WASD, thank you.

    • @Scrufflord
      @Scrufflord 5 лет назад +15

      Thank you! I always thought arrow controls were a little wonky. (Maybe I could add both? Who knows what the preference of the person that plays my game will be?)

  • @sunhouhua
    @sunhouhua 4 года назад +399

    Pressing F4 in the code editor lets you add if statements, blocks, etc.
    You're welcome

    • @matnic_6623
      @matnic_6623 4 года назад +2

      Thats actually very useful as I am a beginer! Thanks!

    • @lightstareight6950
      @lightstareight6950 4 года назад

      ty

    • @QBelly
      @QBelly 4 года назад +80

      ALT + F4 opens a secret passage to Narnia.

    • @395leandro
      @395leandro 4 года назад +11

      Delete System(x64) to remove lag.

    • @lightstareight6950
      @lightstareight6950 4 года назад +6

      install hackintosh to get 2 fps

  • @blakeburgers22
    @blakeburgers22 9 месяцев назад +51

    This was SOOO helpful! I’m 14 years old and I’ve been wanting to code my own video game for a while now, moving on to part two! (I’m hopeful! 🤞)

    • @milokochili
      @milokochili 8 месяцев назад +1

      Same here, it has been so useful and only has been the first part

    • @laxels8835
      @laxels8835 8 месяцев назад +1

      same also

    • @SecretarySquare
      @SecretarySquare 8 месяцев назад +1

      yup

    • @patopeje1472
      @patopeje1472 8 месяцев назад +1

      man... I meet gamemaker at my 14, and I didn't understand a sh*t because in that time there wasn't RUclips tutorials, and I didn't understand english pretty well
      you are so lucky lol

    • @blakeburgers22
      @blakeburgers22 8 месяцев назад +1

      @@patopeje1472 lol! Fr

  • @ShahriarahmedShobdo
    @ShahriarahmedShobdo 5 месяцев назад +3

    My brother wants to make games, so i gave him a chance. after one hour i saw him writing this in the computer:
    if (scrolling_through_twitter = true)
    {
    dad_visible = false;
    }
    else
    {
    dad_visible = true;
    }
    💀💀💀💀

  • @jaded9436
    @jaded9436 3 года назад +189

    I'm really interested and following along. But it feels like my brain is going to explode at the same time. These videos are super helpful.

    • @CommanderHof
      @CommanderHof 3 года назад +4

      yooo same

    • @RickyTheRoster
      @RickyTheRoster 2 года назад +1

      Bro which version is this when i download it from Google when i open it it always say it stopped working what to do

    • @Innocentzz
      @Innocentzz 2 года назад

      same

  • @leodacosta1
    @leodacosta1 4 года назад +241

    This video made coding fun for me. So much so that I made it wall jump!
    //Wall Jump
    if (place_meeting(x+hsp,y,oWall)) && (key_jump)
    {
    vsp = -7;
    }
    Thanks!!! You are an awesome teacher :D

    • @hole1274
      @hole1274 3 года назад +9

      for anyone looking to copy this, you might also add momentum away from the wall
      hsp = -sign(hsp) * 2;
      and if you're doing it after the collision (which makes sense) hsp will be 0, so save sign(hsp) in the collision and set the walljump's place meeting to (x+hSignVariable,y,oWall)

    • @captaincharlie1044
      @captaincharlie1044 3 года назад +4

      @@hole1274 excuse me, could you rewrite the code the original poster posted? your description of what to do isnt making a lot of sense, sry im a beginner

    • @hole1274
      @hole1274 3 года назад +13

      @@captaincharlie1044 I found a better way since then
      //check for a wall in the direction you're pointing
      if (place_meeting(x+move,y,oWall)) && (key_jump)
      {
      vsp = -7;
      hsp = -3 * move; //move away from the direction you're pointing
      }

    • @captaincharlie1044
      @captaincharlie1044 3 года назад

      @@hole1274 youre a lifesaver!! Thank you!

    • @captaincharlie1044
      @captaincharlie1044 3 года назад +1

      @@hole1274 alright, sorry for keeping this going, but the wall jump works! however, i dont want the player to be able to just keep on wall jumping up the same wall over and over. i want them to kind of bounce away from the wall naturally after one walljump. would you know how to do this? if its easier(and if you have discord) my discord username is EdgeGod27 #3004

  • @andrewchariker1246
    @andrewchariker1246 5 лет назад +75

    [SOLUTION]
    If your player is "floating" and stays in the air too long, then you need to raise your grv variable. At 29:03, Shaun changes the value from 0.1 to 0.3. He does it really fast and might be hard to catch. Good luck with your game!

  • @yanisel3477
    @yanisel3477 3 года назад +54

    Game Maker Studio is like a mix of unreal engine of blueprint and C++ with an actual good 2d implementation

  • @dang1854
    @dang1854 5 лет назад +218

    This was AWESOME! I had a couple glitches as I went. My mistakes helped me learn stuff:
    1. If you're seeing boxes to drag instead of a place to type in the Create tab as shown in the video, right click and select Switch to GML.
    2. I had a typo in one of my variables in the Create tab. I had walkvp instead of walksp! Also, WALKSP is not the same as walksp - capitalization DOES count.
    3. I had semicolons at the end of my if and while statements. Don't put semicolons there.
    4. I put a semicolon instead of a comma in one of the x,y+1,o_wall statements.
    Excellent, nay, PERFECT video for a first timer.

    • @volk4342
      @volk4342 4 года назад +3

      ty

    • @Baleur
      @Baleur 4 года назад +3

      Well its better to think of it this way, dont put semicolons when a { follows after it.

    • @aydemironur35
      @aydemironur35 3 года назад

      lol ty i was searching where im doing the mistake :D

    • @findtheshuaibs3888
      @findtheshuaibs3888 3 года назад +4

      I can't get past this part for some reason, my player just automatically goes left all the time and i cant bring it to the right
      Edit: fixed it, i wrote x = x * hsp; which was why it wasn't working

    • @jacosazul
      @jacosazul 3 года назад +1

      ty

  • @zaynebmoin9917
    @zaynebmoin9917 4 года назад +69

    use f8 and f9 keys to zoom in and out in event code
    I'm pretty sure this is useful!

    • @PandaFishification
      @PandaFishification 4 года назад +2

      Thank You!!

    • @jenniferg224
      @jenniferg224 4 года назад +8

      uh, on my computer its f7 and f8.. not trying to be rude but just letting people know in the replies if they have any issues ;D

    • @ichifish
      @ichifish 4 года назад

      Wish I'd looked down here before I googled it! Thannks!

  • @lunasoldev
    @lunasoldev 4 года назад +88

    If you want to add sprinting to the game you just need to put:
    key_sprint = keyboard_check(vk_shift);
    to the key section
    and add:
    if(key_sprint)
    {
    hsp *= 1.75;
    }
    in front of:
    x = x + hsp;

    • @NIKOSPARAPONIARIS
      @NIKOSPARAPONIARIS 4 года назад +2

      It Works! But (after adding this feature after the next tut) there is an issue.. stacking on walls .. i guess its a collision problem!

    • @hansliu960
      @hansliu960 3 года назад +1

      Nikos Paraponiaris yes I’ve met a similar situation, it seems to be sticking around the closed angles, may need additional code to get it run smoother

    • @FulsomeFrog
      @FulsomeFrog 2 года назад

      I can't seem to get this to work, idk why maybe its just different versions of gms2 broke stuff or im being dumb and messing up things somehow

  • @persianshayan3700
    @persianshayan3700 5 лет назад +391

    First game making Tutorial i watched until the end. I enjoyed it && learn alot. So...
    {
    I subscribed
    }

    • @falilivud6937
      @falilivud6937 5 лет назад +12

      Are you acting like code *||* are you just getting insane by codes

    • @ohmai1290
      @ohmai1290 5 лет назад +14

      you just forget the semicolon at the end, lol

    • @legsofjelly4428
      @legsofjelly4428 5 лет назад +20

      if (likes_video == true)
      {
      subscribe = true;
      }

    • @Snailsxd
      @Snailsxd 4 года назад +6

      @@legsofjelly4428 you don't need to check if it's true, if you just put in the value it'll check for you

    • @nokutokamomiji
      @nokutokamomiji 4 года назад +5

      Radio oHmAi Actually, GML (The language used in GameMaker Studio 2) doesn’t require the use of semicolons.

  • @mattyouland4848
    @mattyouland4848 3 года назад +3

    //Get Player Input
    key_left = keyboard_check(vk_left);
    key_right = keyboard_check(vk_right);
    key_jump = keyboard_check_pressed(vk_space);
    //Calculate Movement
    var move = key_right - key_left;
    hsp = move * walksp;
    vsp = vsp + grv;
    //horizontal Collision
    if (place_meeting(x+hsp,y,oWall))
    {
    while (!place_meeting(x+sign(hsp),y,oWall))
    {
    x = x + sign(hsp);
    }
    hsp = 0;
    }
    x = x + hsp;
    //vertical Collision
    if (place_meeting(x,y+vsp,oWall))
    {
    while (!place_meeting(x,y+sign(vsp),oWall))
    {
    y = y + sign(vsp);
    }
    vsp = 0;
    }
    y = y + vsp;
    game wont run keep getting errors, i was at 29:28 in video what is wrong with my code?

    • @nottheresenpaii
      @nottheresenpaii 3 года назад

      //Player Input
      key_left = keyboard_check(ord("A"));
      key_right = keyboard_check(ord("D"));
      key_jump = keyboard_check_pressed(vk_space);
      //Calculate Movement
      var move = key_right - key_left;
      hsp = move * walksp;
      vsp = vsp + grv
      //Horizontal Collision
      if (place_meeting (x+hsp, y, oWall))
      {
      while(!place_meeting(x+sign(hsp), y, oWall))
      {
      x = x+sign(hsp);
      }
      hsp = 0;
      }
      //Movement
      x = x + hsp;
      //Vertical Collision
      if (place_meeting (x, y + vsp, oWall))
      {
      while(!place_meeting(x, y + sign(vsp), oWall))
      {
      y = y+sign(vsp);
      }
      vsp = 0;
      }
      //Movement
      y = y + vsp;
      Here is my code, you can compare the two, or you can copy paste it to test and run it, it works for me. The only thing to keep in mind is that my movement keys are "A" and "D", but you can change those if you like

    • @SuperBlueOrange_
      @SuperBlueOrange_ 3 года назад

      here is my working code and plz ignore my spelling also this is for wasd keys
      ///controls(movement)
      key_left = keyboard_check(ord("A"));
      key_right = keyboard_check(ord("D"));
      key_jump = keyboard_check_pressed(vk_space);
      ///telling the system what to do with that information
      var move = key_right - key_left;
      ///horrzotle speed control
      hsp = move * walksp;
      vsp = vsp + grv
      if (place_meeting(x,y+1,O_gound_one)) and (key_jump)
      {
      vsp = -7

      }
      //horizontal collision
      if (place_meeting(x+hsp,y,O_gound_one))
      {
      while (!place_meeting(x+sign(hsp),y,O_gound_one))
      {
      x= x + sign(hsp) ;
      }
      hsp = 0
      }


      x = x + hsp
      //vertical collision
      if (place_meeting(x,y+vsp,O_gound_one))
      {
      while (!place_meeting(x,y+sign(vsp),O_gound_one))
      {
      y= y + sign(vsp) ;
      }
      vsp = 0
      }


      y = y + vsp

  • @dormin100
    @dormin100 6 лет назад +307

    [[ SOLUTION ]]
    Lots of guys having a problem where the player just falls into the ground and become incapable of moving, i had the same problem and found some unanswred comments asking for help..
    i latter found that the IF statment on the vertical collision part had "y+sign(vsp)" written rather than 'y+vsp", wich is the correct way...
    im proud as a begginer to have discovered the logical problem by myself, although i shoudn't had comited it in the first place hahaa

    • @pedroinogueiras
      @pedroinogueiras 6 лет назад +3

      Thanks, you are a true god.

    • @masonclark702
      @masonclark702 6 лет назад

      this didnt work for me is there any other fix as ive been looking for weeks with no luck thanks

    • @dormin100
      @dormin100 6 лет назад +2

      Mason Clark be sure to check the collision masks and the origin points as they can also produce some weird bugs

    • @jessedamon2825
      @jessedamon2825 6 лет назад +1

      Why did this work? This solution worked for me but I don’t understand why becquse the videos code had the (x,y+sign(vsp),oWall)

    • @dormin100
      @dormin100 6 лет назад +3

      Jesse Damon if you set the collision to check on y+sign(vsp), it will be true everytime the collision mask is exactly one pixel above the ground, and will send you to the same place again and again and again

  • @jaydawn8704
    @jaydawn8704 7 лет назад +127

    Although my vision for what I want to make isn't a platformer, this was an awesome intro and I'm a little upset I'm so early to the series because I want to spend a day just working through these tutorials! It's like when you start watching a show during it's initial air vs when the series is complete, the wait is awful lol.

    • @manwhodoesthings
      @manwhodoesthings 6 лет назад +1

      i can't even get pass the vertical coding part. lol.

    • @OnBrandRP
      @OnBrandRP 5 лет назад +7

      Just a tip for any future game developers, when you get stuck like this, duplicate your project then start experimenting. or have other smaller projects to work on.

    • @uanamenezes7689
      @uanamenezes7689 Год назад

      @@OnBrandRP thank you for the tip

  • @marianateixeira9251
    @marianateixeira9251 4 года назад +20

    I don't often write comments on videos, but I feel obligated to thank you for an amazing set of tutorials with good start. I'm excited to be able to code my first game, as I've only worked as an artist in video-games.

  • @hildanateghi778
    @hildanateghi778 6 лет назад +83

    mine does not have a ''typing bar'' i cant type in the codes when creating events, heeeelp :))))

    • @freya4333
      @freya4333 6 лет назад +80

      Right click on the empty space (left of the tool box) and click 'Convert to GML'

    • @LunaRiddle77
      @LunaRiddle77 6 лет назад +10

      Freya Marshall Woooo thank you, I had the same problem and I was starting to think I did something wrong :0

    • @hildanateghi778
      @hildanateghi778 6 лет назад +4

      thank you soooooo much!

    • @100Jim
      @100Jim 6 лет назад +1

      Thanks worked for me!

    • @scorpio7536
      @scorpio7536 6 лет назад +1

      omg thx man

  • @jase1976
    @jase1976 6 лет назад +44

    Thanks you, this is great. I was struggling with other tutorials to understand the code, but I understood most of this and feel I'm making progress for the first time with all this making games stuff. I'm looking forward to continuing.

    • @chappie3642
      @chappie3642 5 лет назад

      Hi, how has it been going?
      As someone who began 2 years ago I hope I Can help

    • @timschuchner
      @timschuchner 4 года назад

      @@chappie3642 I am curious as well how you are both doing since I just started with gms this month.

    • @chappie3642
      @chappie3642 4 года назад

      @@timschuchner I don't code with GSM, I know Java and C++, I usually use my own engine

    • @falingo
      @falingo Год назад

      how is your progress

  • @matissebriers5032
    @matissebriers5032 4 года назад +17

    I was having a problem where my player would just fall through the ground
    I fixed it by :
    1. Going to the player sprite in the workspace tab and expanding collision mask (left hand side)
    2. setting mode to "manual"
    3. looking at the sprite preview window and clicking and dragging a black box over the entire sprite
    I think the reason I got this error is that I changed the origin of the object ( in the video somewhere around 2:03) to top left instead of center but i'm not sure.

    • @bioshockgril
      @bioshockgril 4 года назад

      i was having an issue where it wasnt stopping on the right side, i did what you suggested and now it's not moving at all lmao.

    • @Thomas-yq5yl
      @Thomas-yq5yl 4 года назад

      Hey man/miss
      I've been coding for a bit and working with stuff like this and yet I thought my code was F***ed. Bouta start again and then I checked the comments. You saved me. Hats of to good sir.

    • @simon3123
      @simon3123 4 года назад

      after 2 days of struggeling i foud your comment, i tried it and it worked!
      thanks man

    • @MachineMan64
      @MachineMan64 4 года назад

      After doing this I still have the green box fall through the ground, it'll still stop at the sides of the walls, but it still falls through. Need help :(

    • @pagina_1316
      @pagina_1316 2 года назад

      I had the same problem but i just deleted the while command in the vertical collision.

  • @illdie314
    @illdie314 7 лет назад +485

    19:27 "you can leave it at 30 if you prefer"
    but you shouldn't prefer

    • @henryw4535
      @henryw4535 6 лет назад +25

      Yep, it looks very slow and choppy in 30fps.

    • @Luka-sf3vu
      @Luka-sf3vu 6 лет назад +1

      xd

    • @randumbcrits6125
      @randumbcrits6125 6 лет назад +8

      CiNeMaTiC 30 fPs

    • @aurorajarvis5502
      @aurorajarvis5502 6 лет назад +3

      a lot of games work even better at higher frame rates than your monitor can push out. Dont believe me? if you're playing counter-strike with a locked frame-rate try taking it off. This isn't something that's discussed all that often because of the power needed to push a game beyond 200 fps. playing a game at 80fps or whatever just means screen tearing

    • @wyzolol
      @wyzolol 6 лет назад

      lol

  • @peterwu5957
    @peterwu5957 4 года назад +10

    Hello,everyone,I'm Peter Wu,come from China.Todey is my first day at RUclips. Nice to meet you,and I'm very happy to study gms2 with you. 😂

    • @FranckOlive
      @FranckOlive 4 года назад

      thats actually very cute

  • @kevo9429
    @kevo9429 6 лет назад +13

    vsp = vsp + grv makes me unable to move my obj, what to do ?

    • @onecanvanbam6775
      @onecanvanbam6775 4 года назад

      I had a similar issue and it was that I'd left a hsp in where we copy and paste it for vertical collision, check there maybe?

  • @qrowbranwen
    @qrowbranwen 5 лет назад +34

    5:01 me when I try to make a straight line with a mouse

  • @delorne2776
    @delorne2776 Год назад +3

    Any idea why I'm getting an error in the Step event? key_left is underlined with message GM2016 - Instance variable 'key_left' declared outside of Create event, declare with 'var' or move to Create event.
    Everything is setup exactly as demonstrated in the video. Similar errors for key_right and key_jump. I'm also getting a naming convention error for move, it says it should be "_move".

    • @Monster_Face_RB
      @Monster_Face_RB Год назад

      same

    • @therealreishady
      @therealreishady 4 месяца назад

      they're just suggestions for keeping things tidy, these errors werent made at the time this video came out so they werent considered. as long as your game still launches they aren't anything to stress over (i know this is a very late reply and you probably figured it out but still lol)

  • @frostee5554
    @frostee5554 2 года назад +9

    im new to GameMaker, I've had a decent amount of coding experience back in high school but I have long since forgotten. You are a god send. you are a wonderful teacher, and great to listen to. thank you for all you do and please, keep doing it!

  • @rupertdenton1
    @rupertdenton1 6 лет назад +10

    This is my first ever comment on RUclips I think. But I just wanted to say thank you for taking the time to make these videos. It is extremely helpful for a beginner.

  • @urielschwanke4092
    @urielschwanke4092 10 месяцев назад +1

    I'am trying to get the horizontal colison to work but i just simply does not, i copied word from word os the video code, but it's not working, tried checking the colision of the wall and its fine, can someone help me.
    here is the code:
    if place_meeting(x + hsp,y,oWall)
    {

    while (!place_meeting(x + sign(hsp),y,oWall))
    {
    x = x + sign(hsp)
    }
    hsp = 0
    }

  • @IBACAU123
    @IBACAU123 6 лет назад +28

    Wow!
    I've watched my first 8 minutes and i've gotten more done than any other tutorial!
    You can sure explain stuff and i'm looking forward to more and more content from you!

  • @shared-knowledge
    @shared-knowledge 4 года назад +9

    as a programmer my self (php/java/X++) i would like to say that this tutorial was a great example of how to do tutorials the right way

  • @sebastianbrya1317
    @sebastianbrya1317 2 года назад +2

    Hey, i need help. For some reason i stick to the ground - when im falling i can move but when i touch the floor i can't do anything. Anyone can help?

  • @moellersworkshop2116
    @moellersworkshop2116 4 года назад +6

    I've been writing platform games since 85' while in high school using 6502 on an Apple IIe, what I've learned in this life is that the most important thing an artist can do (that is what we all are) is to master the rudiments, before we can construct the fantastic. I really enjoyed getting this man's perspective on "elegant logic" for good object control in a platform game construct. You "experts" are encouraged to just go over this step by step and you may be surprised at a perspective you didn't have on some very elemental, but critical components of game making. Thanks again Shaun.

  • @timtam4596
    @timtam4596 Год назад +7

    It's possible to experience a game freeze using this method of movement/collision if you character falls onto the corner of a block at certain angles. From what I remember, this is because the collision wasn't set up for diagonal collision, so to avoid the issue, add this below your horizontal and vertical collision
    //Diagonal Collision
    if (place_meeting(x+hsp,y+vsp,oWall))
    {
    while (!place_meeting(x+sign(hsp),y+sign(vsp),oWall))
    {
    x += sign(hsp);
    y += sign(vsp);

    }
    hsp = 0;
    vsp = 0;
    }

    • @voidymite
      @voidymite Год назад +1

      W, thanks

    • @susniynarezchik
      @susniynarezchik Год назад +1

      This is really nice, its working and good for basic platformer, but if you need to build up momentum in your game, this code actually might kill it.

    • @timtam4596
      @timtam4596 Год назад +1

      @@susniynarezchik I haven't had any issues using acceleration and this code so far, as all the code is for is to stop you from getting frozen in a while loop when you land on a corner at a near perfect 45 degree angle, which is pretty much the only time the code seems to fire

    • @timtam4596
      @timtam4596 Год назад +1

      @@susniynarezchik On second thought I have had some issues with losing momentum. Do you have a more elegant solution?

    • @susniynarezchik
      @susniynarezchik Год назад +1

      ​@@timtam4596 Yooooo i didnt think you would adress my comment that fast! As i said, your code works perfectly fine without need of any momentum implementation, but in my case it didnt work out. So, for example, i tried saving data of hsp to some momentum_saver variable right before the jump (i had set different accel/decel for it), but right before the variables data gets saved, it changes to 0. First of all, i tried saving hsp data at a different place, but I couldnt get it accurate enough. For now, i basically did a simple pre-hmove check, and turned hsp to 0 if future collision detected (also i needed that bc my character goes way too fast for game to control), and before that i save my momentum data. it turned out smth like that:
      //Horisontal collision
      if (place_meeting(x+hsp, y, oPlatform) ){
      while (!place_meeting(x+sign(hsp),y,oPlatform)){
      x = x + sign(hsp);
      momentum_save = hsp;
      }
      hsp = 0;
      }
      //momentum save (post collision check)
      if (place_meeting(x - hsp, y - vsp, oPlatform) and state_c == "running"){
      momentum_saver = hsp;
      }
      //Pre horizontal move check
      if (place_meeting(x+hsp,y,oSpikes) or place_meeting(x+hsp,y,oPlatform))
      {
      hsp = 0;
      }
      x = x + hsp;
      Yeah, as u get it, i am new to gm, and i very appreciate your help to us, newbies. I guess i might find more elegant solution later, but it is what it is right now. (And yeah lol, sorry for any potential grammar mistakes i made here, since english isnt my first language.) Anyways, wishing you best of luck!

  • @cactus7524
    @cactus7524 7 лет назад +28

    steps script:
    //Get Player Input
    key_left = keyboard_check(vk_left);
    key_right = keyboard_check(vk_right);
    key_jump = keyboard_check_pressed(vk_space);
    //Calculate Movement
    var move = key_right - key_left;
    hsp = move * walksp;
    vsp = vsp + grv;
    if (place_meeting(x,y+1,oWall)) && (key_jump)
    {
    vsp = -7;
    }
    //Horizontal collision
    if (place_meeting(x+hsp,y,oWall))
    {
    while (!place_meeting(x+sign(hsp),y,oWall))
    {
    x = x + sign(hsp);
    }
    hsp = 0;
    }
    x = x + hsp;
    //Vertical Collision
    if (place_meeting(x,y+vsp,oWall))
    {
    while (!place_meeting(x,y+sign(vsp),oWall))
    {
    y = y + sign(vsp);
    }
    vsp = 0;
    }
    y = y + vsp;

    • @iurydantas4787
      @iurydantas4787 7 лет назад

      Thank you! Ive started writing in my notebook but then he put lines between other lines and it all went hell! xD

    • @cactus7524
      @cactus7524 7 лет назад

      XD

    • @iurydantas4787
      @iurydantas4787 7 лет назад

      I think there is a reference problem, make sure that oplayer its written the same on the objects and in the code. Is it really Oplayer with capital O and low p or its like oWall, only the W capital?

    • @hansturbela9514
      @hansturbela9514 7 лет назад

      Cactus ty

    • @gamelsrael
      @gamelsrael 7 лет назад

      Its write to me on vertical and horizontal collision "malformed if statement".
      What to do?

  • @lucacontarino4882
    @lucacontarino4882 4 года назад +5

    while(Didn't understand)
    {
    watch the video again
    }
    Kinda need a way to break the cycle soon or late..

  • @maudesaur
    @maudesaur Год назад +5

    This was so well explained, not only did I enjoy it, but I also verbally made noises in awe of how simple it actually is. THANK YOU.

  • @ignskeletons
    @ignskeletons 3 года назад +9

    Just an incredible tutorial series, you've given so much to us through your content and I appreciate it a bunch :)
    Just resubscribed to your Patreon!

  • @PulseCS2
    @PulseCS2 2 года назад +2

    i cant run the game what do i do?

  • @raspberry_picker395
    @raspberry_picker395 7 лет назад +55

    Chris Martin is one of your Patreon supporters? Nice.

  • @jumpiergames985
    @jumpiergames985 5 лет назад +5

    Literally watched this 8 times and cant get my player to go, i know a lot of gml and gm2 and the code doesnt work
    Took me awhile code works you ser this, im wrong sorry, i had 2 dk_lefts, silly meeeee

  • @DeZJuice
    @DeZJuice 3 года назад +1

    Typed the code in exactly and player won’t move. any solutions?

    • @DeZJuice
      @DeZJuice 7 дней назад

      yeah turns out i put left twice.

  • @gamemastery4227
    @gamemastery4227 4 года назад +6

    I was actually happy when in the end player was moving and jumping around :D

  • @taimjnaidi8156
    @taimjnaidi8156 5 месяцев назад +4

    Horizontal collision ain't working

  • @broda2685
    @broda2685 2 года назад +1

    Hey I bought and download the code but when I run the game and kill an enemy I got a shader error any help in resolving the issue?

  • @daniel_1378
    @daniel_1378 5 лет назад +7

    Whenever the player collides with the wall, he gets stuck halfway inside it, and cant move. Someone help pls?

    • @ZiggyStyley
      @ZiggyStyley 4 года назад +2

      check your spelling on some of the code I had an issue like this because I spelt "sign" as "sigh"

    • @jackrenney4122
      @jackrenney4122 3 года назад +2

      @@ZiggyStyley i know this was 5 months ago but thanks for this comment i was banging my head against the wall

    • @ZiggyStyley
      @ZiggyStyley 3 года назад +1

      @@jackrenney4122 the comments on these videos are timeless

  • @AtlasInTheWest
    @AtlasInTheWest 6 лет назад +12

    I’m immediately running into an issue, I’ve copied down exactly the coding you used and yet my character will not move when I press the left and right buttons

    • @princessmossy6930
      @princessmossy6930 6 лет назад +5

      I know this is three months old but I found the solution to this for anyone who was wondering like I was. What I did was in the map placed the sprites into the room. You need to place the OBJECTS into the room. The sprites are just pictures they aren't the objects with the coding. Replace the sprites with objects and this should work!

    • @AtlasInTheWest
      @AtlasInTheWest 5 лет назад +1

      Princess Mossy I actually figured that out myself a few days after I commented this, but thanks!

    • @tithatario3915
      @tithatario3915 5 лет назад

      @@princessmossy6930 not working for me. I used an object. No movement :(

    • @isaacsachs4244
      @isaacsachs4244 5 лет назад

      @@tithatario3915 I have the same problem. Did you end up figuring it out?

    • @lucamateipintilie7006
      @lucamateipintilie7006 5 лет назад

      Contact Parkour
      This is a very bad idea, but I don’t want to bother with tech support so try to use drag and drop mode and use the tutorials from the official website of the devs. Basically there are blocks that do the typing for you. Like a puzzle. Good luck.
      Plus it might be an update that broke it. I’ll try another time

  • @pb_jellyfish
    @pb_jellyfish 2 года назад +1

    For some reason after I added the gravity I wont move when i'm on the ground but only when falling.

  • @rockzom
    @rockzom 7 лет назад +51

    Thanks, Shaun! Wonderful stuff.

  • @lunch7497
    @lunch7497 2 года назад +22

    To anyone who wants to use WASD instead of arrow keys you can replace the
    vk_left vk_right vk_space
    with
    ord("A") ord("D") ord("W")
    Hope this helps 🙂

    • @pen_man375
      @pen_man375 10 месяцев назад

      it did not work can you help me pls

    • @ucx
      @ucx 10 месяцев назад

      @@pen_man375
      key_left = keyboard_check(ord("A"));
      key_right = keyboard_check(ord("D"));

  • @leedleleedlelee6912
    @leedleleedlelee6912 5 лет назад +5

    nothing is appearing when im pressing play, help plz
    edit: nvm j was running the wrong room

  • @gabeworks_
    @gabeworks_ 10 месяцев назад +1

    Instructions unclear, i created Red Dead Redemption 3

    • @shingo767
      @shingo767 10 месяцев назад

      good job?

  • @super-creative-stuff1421
    @super-creative-stuff1421 5 лет назад +4

    The collision code works great but there is one problem with it. Since it doesn't check the space in-between the character's current position and their future position, if they're moving fast enough, their future position will be past the object they should have collided with and they'll appear to phase through it. To be fair my improved code is a little long winded so if you know this will never be an issue in your game, then The original code might be better suited:
    *also I'm using xDist instead of hsp and yDist instead of vsp
    //I'm keeping sprite_width-height in abs incase the sprite has been mirrored
    //x(horizontal)
    //segScan is how many collision boxes fit in the distance to be traveled not including fractions of the collision box
    segScan = 0;
    if (abs(xDist) > abs(sprite_width)){
    segScan = floor(abs(xDist) / abs(sprite_width));
    }
    //loop through all of the segscan intervals
    for (i = 0; i

    • @iwillgotokoreawhenigrowup8155
      @iwillgotokoreawhenigrowup8155 5 лет назад +5

      super-creative-stuff BRO THANKS FOR YOU HARD WORK BUT IM SO NOT GONNA TRY IT CUZ ITS TOO LONG AND SCARY

    • @TheRealModiK
      @TheRealModiK Год назад

      @@iwillgotokoreawhenigrowup8155 I feel you so much rn

  • @Etcher
    @Etcher 5 лет назад +5

    Excellent work Shaun, thank you! Love this series. I come back to the later episodes regularly to remind myself about certain techniques as I need to implement them. Thanks again.

  • @totofer7748
    @totofer7748 2 года назад +1

    How can you still run the game despite the unused variables? when I try to play it, it just says it faled to load the game.

  • @fabiochiodi576
    @fabiochiodi576 5 лет назад +8

    Sorry but the sprite does not move and I do not understand why

    • @joyfulnobody
      @joyfulnobody 5 лет назад +1

      @Na Na Then it moves left forever

    • @joyfulnobody
      @joyfulnobody 5 лет назад

      @Na Na Thanks this really helped.

    • @joyfulnobody
      @joyfulnobody 5 лет назад

      @Na Na Yes, I downloaded it last week.

    • @joyfulnobody
      @joyfulnobody 5 лет назад

      @Na Na Thanks!

    • @joyfulnobody
      @joyfulnobody 5 лет назад

      @Na Na You've been a really big help. But could you do me one more favor? When I preview my sprite animation it doesn't loop, it goes forwards, left right left right, forwards.(the frames per second). If you could help I'd really appreciate it. Thx!

  • @thatguyorgal1840
    @thatguyorgal1840 10 месяцев назад +2

    just curious if you'd be able to help, this is my second time round following this whole series but this time the after doing the vertical collision the player floats for a moment before teleporting to the floor?

    • @thatguyorgal1840
      @thatguyorgal1840 10 месяцев назад

      nvm i forgot y=y+vsp, silly me

    • @shingo767
      @shingo767 10 месяцев назад

      ah ok@@thatguyorgal1840

  • @daris-oddy5919
    @daris-oddy5919 4 года назад +6

    after the Vertical movement my character didn't move anymore
    pls help

    • @wileywilson
      @wileywilson 4 года назад

      Double check your code matches Shaun's. I've just followed this through after downloading GM2 yesterday and it works fine.

    • @onecanvanbam6775
      @onecanvanbam6775 4 года назад

      I had a similar issue and it was that I'd left a hsp in where we copy and paste it for vertical collision, check there maybe?

    • @AnnaMc456
      @AnnaMc456 4 года назад

      I had a similar issue. The problem was that my character's "hitbox" or "frame" (for lack of better term) was overlapping with the ground (or wall, in this video). So, the character couldn't move because it had been instructed to not move upon collision, and collision started as soon I ran the game. The solution was to simply move the character away from the ground (or wall).

  • @t-boneproductions6779
    @t-boneproductions6779 5 лет назад +4

    You're very smart. I'm barely grasping key points here. Thank you for the video. I'm using my android for a fps creator, and so far the video has been very helpful. Thank you man.

  • @graysonmiller7911
    @graysonmiller7911 4 года назад +1

    he did not even tell that you have to choose gamemaker language now I have to restart

  • @onetrueandrew
    @onetrueandrew 7 лет назад +8

    What is the best way to become proficient in GML and Game Maker Studio 2? Obviously tutorials and trial and error, but any other suggestions for learning?

    • @onetrueandrew
      @onetrueandrew 7 лет назад +9

      I've put in a week's worth of time and practice. It paid off. Submitted my first game, Recoil, to the GMTK jam tonight. Thanks for everything you've taught! Check me out on itch. io if you like, creator name is brotherpixel.

    • @garoldgoatgaming2923
      @garoldgoatgaming2923 6 лет назад +2

      I just played your game and it's a lot of fun!

  • @PrinzessinRamode
    @PrinzessinRamode 3 года назад +3

    Thanks! This was helpful. I had been trying with the drag and drop style for so long. I got them to work most of the time, but it was always slightly off. This was quite helpful.
    Can you make a tutorial for SNES style racing games like Top Gear (Top Racer in Japan and Europe)? :)
    These games aren't Mode 7, just typical behind the player camera that only moves forward (can't turn around).

  • @oliverlam6072
    @oliverlam6072 2 года назад +1

    I'm confused. I followed everything, but I can't get the movement to work. Here's my code:
    Create:
    hsp=0;
    vsp=0;
    grv=0.1;
    walksp=4;
    Step:
    key_left=keyboard_check(vk_left);
    key_right=keyboard_check(vk_right);
    key_jump=keyboard_check_pressed(vk_up);
    var move=key_right-key_left;
    hsp=move*walksp;
    x=x+hsp;
    If anybody knows what's wrong, please tell me.

  • @RaposaCadela
    @RaposaCadela 5 лет назад +4

    "hsp = move * walksp;" makes my game not open, for whatever reason. I tried to close and open the project back again, and now the interface is all gone, and I can't get it back!

    • @MotoXJuan
      @MotoXJuan 4 года назад

      i did the same thing. turns out i had my step code in create, and create code in step, when it should have been the other way around

  • @GodOfTetris90
    @GodOfTetris90 5 лет назад +7

    Thanks Shaun for this amazing tuto. i allways try to implement a liitle more so i can learn. I did double jump and it work perfect. keep it up

  • @HungryTheFoxKing
    @HungryTheFoxKing 5 месяцев назад +2

    this was unhelpful. the video was well explained however i found there to be several errors in the code. I don't know what went wrong since I followed this video to a tea.

    • @aasray
      @aasray 4 месяца назад

      Probably he is using an older version Game Maker Studio 2. Whereas you're using GameMaker. For example, the newer version the variable is called gravity not grv etc..

  • @dailyd535
    @dailyd535 6 лет назад +4

    I don't know why but my computer is taking a lot of time for running the game in 60 FPS..

  • @Spike-kg3zy
    @Spike-kg3zy 4 года назад +4

    Does anyone know why I'm just snapping through the floor. After a certain amount of time, the player just zooms straight down. Is it something to do with the gravity constantly increasing?

    • @Shibi_Cherry
      @Shibi_Cherry 4 года назад +2

      Did you set the collision mask in the centre?

    • @JustinKoenigSilica
      @JustinKoenigSilica 4 года назад +1

      did you limit your gravity to be set to like, 10 when it goes over that amount?
      are you resetting gravity when you touch the floor?

  • @goli8699
    @goli8699 3 месяца назад +1

    Old video, but it still appears to work for whatever I'm doing so that's convenient.
    Very well explained as well. I think understand GML a lot better now (still not great, but at least I got the basics on how variables work)

  • @goob30
    @goob30 4 года назад +5

    The code keeps giving me this error: "Variable (blank) has only been referenced once."

    • @lunasoldev
      @lunasoldev 4 года назад +2

      Thats because variables like key_jump arent used yet dont worry about this error its not bad its gonna be fixed later!

    • @goob30
      @goob30 4 года назад +1

      @@lunasoldev i watched the entire vid and nothing was fixed -_-

    • @lunasoldev
      @lunasoldev 4 года назад

      @@goob30 just keep going with the tutoriald sn whete exactly does it say the error

    • @hulyacekmez460
      @hulyacekmez460 4 года назад

      change controls to right A left D key so it works. you can do it like this: key_left = keyboard_check (ord ("A"));
      key_right = keyboard_check (ord ("D"))
      It happens if you do the same.

    • @futurevisionarchives3995
      @futurevisionarchives3995 3 года назад

      @@goob30 basically ignore it until it is used again, it simply means the code doesn't have another instance of running

  • @jedidiah2686
    @jedidiah2686 6 лет назад +4

    I am very new to GML. I have been using the drag and drop in gm:1 for a few years so it nice to learn GML. As a challenge I tried to add triple jumping without any tuts and I finally did it. You just have to add a var called airj and set it to 0 in the create event. Then add airj = 0; to the check for wall on y, then add if (!place_meeting(x,y+1,obj_wall)) && (key_jump) && (airj < 2) {
    vsp = -7;
    airj = airj + 1;
    }
    to the bottom of the code.

    • @XO-cq6gx
      @XO-cq6gx 5 лет назад

      Hey! I have a question, I can only double jump 1 time, how do I make it unlimited

    • @Isakube
      @Isakube 5 лет назад

      @@XO-cq6gx use drag n drop lol. i tried it and you can jump unlimited times without adding the y+1 thing

  • @LordAdriox
    @LordAdriox 10 месяцев назад +1

    There must have been an update because I can't hold ALT to paint my walls into the room. Holding ALT now seems to do the same thing as holding the middle mouse button
    Edit: Okay I found my issue. I was pressing left ALT instead of right ALT

    • @darkchild130
      @darkchild130 10 месяцев назад

      I had the same issue today.

  • @RobotKitsune
    @RobotKitsune 5 лет назад +17

    Just tried this tutorial out--and I had a lot of fun with it! It's so satisfying to see the code at work. Thank you for the great lesson!

  • @Cynicaall
    @Cynicaall 6 лет назад +6

    Hello there, im very new to this but i had an error occur, i placed in the correct coding you've shown in the video, followed all the right steps but... when i had opened my game, my square (the player) moved on its own to the right then it had left off of the game screen, my key controls didn't move it, or anything. i decided to try this again and had the same issue. my keys work just fine, because i play games that use the key functions. Could you maybe help me out? or try to figure out a solution to this error,

    • @MrWebcammer
      @MrWebcammer 6 лет назад +1

      Hey! Just in case you haven't found an answer to your problem yet double check make sure you are doing everything in the same way he does in the video. It can be confusing to follow along at times but it's always good to pause and go through the code character by character after every line to learn it. Also it sounds like somewhere you're telling the object to move positively along the x axis aka to the right. He does this in the first while statement so I'd check your code there first. Good luck!

    • @mont.s6513
      @mont.s6513 6 лет назад +1

      i had the same problem! just check that instead of having x = x + hsp, it’s y = y + vsp
      was trying to figure out what was wrong for about an hour, hahaha. hope it helps!

    • @EmberEngine
      @EmberEngine 6 лет назад +1

      The same thing happened to me, and then I realized I put a + instead of a *.

    • @HuseyinC.K.
      @HuseyinC.K. 5 лет назад

      İ deleted the while parts for both vertical and horizontal, worked for me.

  • @DeadManRising36
    @DeadManRising36 4 года назад +2

    how do I make the player stay on those walls if the walls move?
    I used this piece of code to make the walls float:
    create event obj_wall:
    anchorY = y;
    frequency = choose(0, 0.05, 0.1, 0.15);
    amplitude = choose(5, 10, 15, 20);
    timer = 0;
    Step Event obj_wall:
    y = anchorY + sin(timer * frequency) * amplitude;
    timer++;

  • @chadcoyle
    @chadcoyle 7 лет назад +22

    I am having a problem when running off a ledge, and immediately running the other direction. I am getting stuck inside the "wall" object by what looks like a single pixel. I tried using round(x) to make sure I am not between pixels but it didn't help.

    • @chadcoyle
      @chadcoyle 7 лет назад +7

      Instead of using my sprite's bounding box, I switched to an even width collision mask sprite for my collisions, and used round(x) for my horizontal movement so I don't end up "between" pixels. This seems to have fixed it.

    • @ClubXXManGame
      @ClubXXManGame 6 лет назад

      Hello. I have the same problem, how to fix it?

    • @followingthetrend_norge2204
      @followingthetrend_norge2204 5 лет назад

      Lol a year later... but i have the same problem

    • @Vaalteq55
      @Vaalteq55 5 лет назад

      @@followingthetrend_norge2204 I think it has something to do with the logic checking for collision. If the player is starts falling at the exact same moment you move back at the wall, the logic correctly detects no wall so movement is allowed. So what happens is the player falls downwards and then because the logic allowed sideways movement it also moves sideways and straight inside the wall

    • @suspiciouswolf933
      @suspiciouswolf933 2 года назад

      im sort of having the same problem but different
      when gravity comes into affect after falling of a ledge (its fine if a jump on the same owall at the same height) i get stuck in one spot a pixel from the owall below and cant move at all, i also can only close the window with the stop playing button instead of the x in the corner
      im having loads of fun with this
      definitely havent been stuck on this problem for hours

  • @airgwgie869
    @airgwgie869 3 года назад +4

    my player kept falling inside the wall however it still moved and was about to jump out, idk what to doooo

    • @vell3445
      @vell3445 3 года назад

      I have the same problem

    • @no-cm5yq
      @no-cm5yq 3 года назад

      Same here, you got a fix?

    • @vell3445
      @vell3445 3 года назад

      @@no-cm5yq I did

    • @no-cm5yq
      @no-cm5yq 3 года назад

      @@vell3445 what is ir

    • @vell3445
      @vell3445 3 года назад

      @@no-cm5yq some one in the game maker server gives me a collision code that never stuck with wall

  • @Austin.Daniel
    @Austin.Daniel 2 года назад +2

    I think everyone needs to aknowledge that this was made all the way back in early 2017

  • @acasualplayer4778
    @acasualplayer4778 3 года назад +3

    Thank you a bunch for this, I made my own game and I'm so happy!

  • @beemckeith4856
    @beemckeith4856 6 лет назад +11

    How can you put in a double jump mechanic??

    • @bearwynn
      @bearwynn 5 лет назад +2

      make a variable and call it number of jumps, when you jump reduce the number by 1, then when it's at 0 make it so you can't jump anymore

    • @funnyvalentine5935
      @funnyvalentine5935 5 лет назад

      @@bearwynn can you teach me how to do that in game maker studio 2 language pls?

    • @GodOfTetris90
      @GodOfTetris90 5 лет назад +2

      hi, if you still dont make it to double jump try this.
      in Create Event, create a variable name it d_jump =1;
      now go to step Event and copy this after the jump code:
      if (!place_meeting(x, y + 1, obj_wall )) && (key_jump) && (d_jump > 0)
      {
      vsp = -7;
      d_jump -= 1;
      }
      if (place_meeting(x, y + 1, obj_wall )) d_jump = 1;
      now you will have double jump

    • @blitzy7742
      @blitzy7742 5 лет назад +1

      @@jeykang1540 you call that simple (; its not for a beginner

    • @osmarreisandrade
      @osmarreisandrade 5 лет назад

      @@GodOfTetris90 it didnt work, maybe cause of the "place_meeting" requirement of the object wall i guess :-:

  • @Karol_polak
    @Karol_polak 6 месяцев назад +2

    hey, there's something wrong, really, because I made the green block and I can't enter the code and I can't, it just writes and nothing happens, can anyone help?

  • @wodosdf107
    @wodosdf107 4 года назад +4

    8:05 I’ve put all of the code in correctly but they all have an error saying
    “Variable *that line* only referenced once”
    Any help?

    • @emilianomanuel2635
      @emilianomanuel2635 4 года назад +3

      ignore it, once you write the movements in step it will disappear , thats just game maker saying "hey, you declared some variables and havent used them... you need them?"

    • @wodosdf107
      @wodosdf107 4 года назад

      Emiliano Manuel Thanks for the help!

    • @mase8444
      @mase8444 4 года назад

      @@emilianomanuel2635 thank you king

  • @sdsada42424
    @sdsada42424 7 лет назад +7

    Guys can someone help? Whenever I touch my platform, the game freezes and I can't close it without using the task manager.

    • @lzmkova
      @lzmkova 6 лет назад +1

      me too

    • @oldpromisejones
      @oldpromisejones 5 лет назад +4

      im sorry you just have a trash pc :/

    • @deeper2147
      @deeper2147 5 лет назад +2

      No.. i's just in the vertical collision.. idkw but if you write : +sign(vps) it won't work. But if you you want it to work and no freez you have to type +vsp (without the sign)

    • @Suzurinn
      @Suzurinn 5 лет назад

      @@oldpromisejones Shaun just made a fuck up with his coding. While I'm unsure of why it worked for his footage (probably editted it in later), I can say even with a high end pc it still freezes the game in a loop. So nothing to do with pc hardware, just an error in code. Anyone trying to make games would be a moron to instantly assume its someones hardware first. Poor programmer, that type of person.

    • @SeanMarbaugh
      @SeanMarbaugh 5 лет назад

      It's because of the while loop being used to push the player right up to the ground.

  • @nanto6865
    @nanto6865 2 года назад +1

    i don't know why, but when i hold ALT in room editor, it moves around like with when holding middle mouse button, and i can't paint resources in room editor... anybody knows how to solve this ?
    Edit : I found it ! i had laptop mode turned on, and that made me be able to pan with ALT, but not paint ! It works now, YAY !

  • @Houndz590
    @Houndz590 5 месяцев назад +8

    Outdated code

    • @Sqooboo
      @Sqooboo 3 месяца назад +1

      Check the top comment

    • @iam-v8498
      @iam-v8498 3 месяца назад +1

      It's working fine for me??

  • @azertyuiazertyuio
    @azertyuiazertyuio 10 месяцев назад +1

    new way to do it:
    create:
    move_speed = 4;
    jump_speed = 16;
    move_x = 0;
    move_y = 0;
    step:
    //move keys input and speed
    move_x = keyboard_check(vk_right) - keyboard_check(vk_left);
    move_x *= move_speed;
    if (place_meeting(x, y+2, obj_wall))
    {
    move_y = 0;
    if (keyboard_check(vk_space)) move_y = -jump_speed;
    }
    else if (move_y < 10) move_y += 1;
    //move and collide
    move_and_collide(move_x, move_y, obj_wall);
    if (move_x != 0) image_xscale = sign(move_x);
    //slopes if you want this make sure that the type of collision mask of your wall sprite is set to rectangle with rotation so you can have slopes
    if (!place_meeting(x+move_x, y+2, obj_wall) && place_meeting(x+move_x, y+10, obj_wall))
    {
    move_y = abs(move_x);
    move_x = 0;
    }

  • @jacklewis256
    @jacklewis256 6 лет назад +4

    1:15 pause the vid and shake your phone lightly and the squares move

    • @cheezed675
      @cheezed675 6 лет назад

      Some people aren't watching on their phones.

    • @Husqe2019
      @Husqe2019 6 лет назад +4

      then shake your friggin' gameboy gosh

  • @ju1cyjon3s31
    @ju1cyjon3s31 3 года назад +2

    is this still useable or is it outdated

  • @foggy9874
    @foggy9874 4 года назад +11

    For the absolute begginers, if you need your player to handle double jump instead of 1 jump in a very simple way:
    if (place_meeting(x, y + 1, oWall))
    {
    moreJump = 1; // variable to set the maximum number of jumps, you can change the value to 2 or 3 or more if you want to add more jumps.
    if (key_jump) vsp -= 7; // don't forget the basic one jump when you're on the ground
    } else {
    if (key_jump and moreJump > 0) {
    vsp = 0; // reset the gravity before jumping again!
    vsp -= 7; // jump again !
    moreJump -= 1;
    }
    }