GameMaker – Tutorial de plataforma



▶ Código fonte: (em breve). ▶ Apoie meu trabalho: https://www.patreon.com/shaunjs Este vídeo é focado em como fazer uma estrutura sólida para um jogo de plataforma na versão mais recente do GameMaker (v2022.1+). Se você deseja fazer um jogo de plataforma enquanto recebe uma introdução mais suave à GML e à codificação e aprende várias outras técnicas, recomendo minha Série Completa de Plataformas: https://www.youtube.com/watch?v=izNXbMdu348

source

28 thoughts on “GameMaker – Tutorial de plataforma

  1. It's groundhog day! You might be wondering why seemingly the same video just came out twice, what happened to the old one? I made a major mistake in the code and had to make the video unlisted. I have since revised my collision method for this video and it works quite differently.

    You might be wondering what went wrong, and its a lot to go into, but a video where I discuss what went wrong and comparing the two collision methods will be coming out next week. Or you can view it now if you're a Patreon supporter!

    Cheers guys and sorry for the confusion and inconvenience.

  2. My character sprite sinks like half a pixel under the object floor sprite/tile. The code is exactly the same as in tutorial. Tried with different collision masks and sprite origins but that doesn't resolve the problem.

  3. How is it that we are all following the same code but having different problems, what can we do to fix this or is it the engine all together and I should just go back to unity where I'm having kinda the same damn problems

  4. How well do you think this would work for a game where the focus is on turn-based gameplay, with side-scrolling just used to navigate maps outside of a battle?

  5. Ah yes, the GM Platformer Basics tutorial. Probably the 100th one at that. We have yet to get past the "basics" part as a community, a feat that Godot devs had done almost 10 years ago by now.

  6. Everything here works just fine except for horizontal collision, I just slowly walk through the wall and fall through

    My Code:

    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;

    x = x + hsp;

    vsp = vsp + grv;

    if (place_meeting(x,y+1,oWall)) && (key_jump)

    {

    vsp = -jumpsp

    }

    // Horizaontal collision

    x = x + hsp;

    if (place_meeting(x + hsp, y, oWall))

    {

    while (abs(hsp) > 0.1)

    {

    hsp *= 0.5;

    if (!place_meeting(x + hsp, y, oWall)) x += hsp;

    }

    hsp = 0;

    }

    x += hsp;

    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;

  7. When I run my program I am running into an error.

    Variable oPlayer.vsp(100013, -2147483648) not set before reading it.

    at gml_Object_oPlayer_Step_0 (line 7) – vsp = vsp + grv;

    How can I fix this?

  8. unfortunately, when pairing this tutorial with the one in the second episode of your platformer series, when running the script, my character cannot move horizontally when in contact with the ground. If i jump, i gen move left and right just fine, but when on the ground, i cannot. I made no alterations to the code of this or the "animation" code in the second episode. Im not sure why adding the sprites broke this part

  9. I am unable to jump. if anyone has a fix, here is my code.
    var _key_right = keyboard_check(ord("D"));

    var _key_Left = keyboard_check(ord("A"));

    var _keyJump = keyboard_check_pressed(ord("W"));

    //Work out where to move horizontally

    hsp = (_key_right – _key_Left) * hspWalk;

    //Work out where to move vertically

    vsp = vps + grv;

    //Workout out if we should jump

    if (canJump– > 0) && (_keyJump)

    {

    vps = vpsJump;

    canJump = 0;

    }

    if (place_meeting(x + hsp, y, oWall))

    {

    while (abs(hsp) > 0.1)

    {

    hsp *= 0.5;

    if (!place_meeting(x + hsp, y, oWall)) x += hsp;

    }

    hsp = 0;

    }

    x += hsp;

    if (place_meeting(x, y + vps, oWall))

    {

    if (vsp > 0) canJump = 10;

    while (abs(vps) > 0.1)

    {

    vps *= 0.5;

    if (!place_meeting(x, y + vsp, oWall)) y += vps;

    }

    vps = 0;

    }

    y+= vps;

  10. every time my character touches a wall he just freezes and idk why. here is my code:
    // getting player inputs

    var _keyright = keyboard_check(vk_right);

    var _keyleft = keyboard_check(vk_left);

    var _keyjump = keyboard_check(vk_space);

    //horizontal movement

    hsp = (_keyright – _keyleft) * hspwalk;

    //vertical movement

    vsp = vsp + grv;

    //jump

    if (canjump– > 0) && (_keyjump)

    {

    vsp = vspjump

    canjump = 0

    }

    // colission

    if (place_meeting(x + hsp,y,owall))

    {

    while (abs(hsp) > 0.1)

    {

    hsp *= 0.5;

    if (!place_meeting(x + hsp,y,owall))

    {

    hsp += hsp;

    }

    }

    }

    x += hsp;

    if (place_meeting(x,y + vsp,owall))

    {

    if (vsp > 0)

    {

    canjump = 10;

    }

    while (abs(vsp) > 0.1)

    {

    vsp*= 0.5;

    if (!place_meeting(x,y + vsp,owall))

    {

    y += vsp;

    }

    }

    vsp = 0;

    }

    y+= vsp;

  11. just finished watching your video, and it looks absolutely amazing, but i have one little question
    what if i wanted to make a character that a sort of retro jump style, that be cant move to the other direction while he is on the air like castlevania for the NES ( in case you didnt understood what i meant, sry for my poor english )

  12. How would I convert this code into a state machine? Where would I call state functions depending on whether the player is walking, jumping, falling, etc.? I really could use some help; I really want to learn.

  13. Hey, I have a tutorial suggestion:

    I have been trying on/off for years to figure out how to code a directional air dash movement for a platformer, like seen in Rocket Knight Adventures.
    I've followed your tutorials for years now and have tried all sorts of things, but I cannot for the life of me figure it out. Would you be willing to do a tutorial on how to achieve movement like that?

Deixe uma resposta

O seu endereço de email não será publicado. Campos obrigatórios marcados com *