[Game Maker Tutorial] Perfect Platformer in 15min!

[Game Maker Tutorial] Perfect Platformer in 15min!



Check out my popular GameMaker Book and GameMaker Courses:

Follow me on Twitch for GameMaker livestreams:

Follow my twitter:
Like my Facebook page:
Follow me on Tumblr:

Thank you all so much for your support!

https://galaxypub.vn/

HeartBeast

38 bình luận trong “[Game Maker Tutorial] Perfect Platformer in 15min!

  1. i remember someone sent me a game they were working on, and i complained that the physics were a bit janky, especially because of the lack of acceleration and deceleration.

    that said, coding can be intimidating for beginners, and it's easy to forget i would've once been begging for a concise tutorial like this one many years ago, so i'm glad you're taking the make these beginner tutorials.

  2. 5 years later… but if u are watching this video and wanna make the fall smoother . Here you go (need to add a new varible called "i")

    /// platform physics

    var rkey = keyboard_check(ord('D'));

    var lkey = keyboard_check(ord('A'));

    var jkey = keyboard_check(vk_space);

    var i = 0;

    ///CKECK FOR GROUND

    if (place_meeting(x, y+1, obj_solid))

    {

    vspd = 0;

    i = false;

    //JUMPING

    if (jkey)

    {

    vspd = -jspd;

    }

    } else

    {

    i = true;

    //Gravity

    if (vspd < 30)

    {

    while (i == true)

    {

    vspd += grav*i;

    i = i+1;

    }

    }

    }

    ///MOVEMENT RIGHT

    if (rkey)

    {

    hspd = spd;

    }

    ///MOVEMENT LEFT

    if (lkey)

    {

    hspd = -spd;

    }

    ///NOT MOVING

    if ((!rkey && !lkey) || (rkey && lkey))

    {

    hspd = 0;

    }

    /// H COLLISIONS

    if (place_meeting(x+hspd, y, obj_solid))

    {

    while (!place_meeting(x+sign(hspd), y, obj_solid))

    {

    x += sign(hspd);

    }

    hspd = 0;

    }

    /// MOVE HORIZONALLY

    x += hspd;

    /// V COLLISIONS

    if (place_meeting(x, y+vspd, obj_solid))

    {

    while (!place_meeting(x, y+sign(vspd), obj_solid))

    {

    y += sign(vspd);

    }

    vspd = 0;

    }

    /// MOVE VERTICALLY

    y += vspd;

  3. _________________________________________

    ############################################################################################

    FATAL ERROR in

    action number 1

    of Step Event0

    for object obj_spongebob:

    Variable obj_spongebob.vsped(100009, -2147483648) not set before reading it.

    at gml_Object_obj_spongebob_StepNormalEvent_1 (line 17) – if (vsped <10) {

    ############################################################################################

    ——————————————————————————————–

    stack frame is

    gml_Object_obj_spongebob_StepNormalEvent_1 (line 17)

  4. Hey heartbeast, if you read this, could you make a tuturial on platformer collisions, but for projectiles that have various slopes/degrees of direction, rather than just whole number horizontal/vertical collision?

  5. Hello Sir thnak you for your tutorial but I have a problem for charge the level
    extends Area2D
    export (String, FILE, "*.tscn") var next_worldfunc _physics_process(delta):
     var bodies = get_overlapping_bodies()
     for body in bodies:
      if body.name == "Player":
       get_tree().change_scene("next_world")I Use your code but It doesn`t reconise the colition area, I don`t know what`s the problem with your original code it reconice but well you now the Player state in the first level, I don`t nkow why it reconice the area with the first code and It can`t with the finally code 
    extends Area2Dfunc _physics_process(delta):
     var bodies = get_overlapping_bodies()
     print (bodies)
     for body in bodies:
      if body.name == "Player":
       get_tree().change_scene("res://Scenes/Word2.tscn")Can you help me !!!!!

  6. /// platform physics

    var rkey = keyboard_check(vk_right);
    var lkey = keyboard_check(vk_left);
    var jkey = keyboard_check(vk_up);

    // check for ground
    if (place_meeting(x, y+1, obj_solid)) {
    vspd = 0;

    // jumping
    if (jkey) {
    vspd = -jspd;
    }
    } else {
    // gravity
    if (vspd < 10) {
    vspd += grav;
    }
    }

    // moving right
    if (rkey) {
    hspd = spd;
    }

    // moving left
    if (lkey) {
    hspd = -spd;
    }

    // check for not moving
    if ((!rkey && !lkey) || (rkey && lkey)) {
    hspd = 0;
    }

    // horizontal collisinos
    if (place_meeting(x+hspd, y, obj_solid)) {
    while (!place_meeting(x+sign(hspd), y, obj_solid)) {
    x += sign(hspd);

  7. Working code Step Event code:

    // platform physics
    rkey = keyboard_check(vk_right);
    lkey = keyboard_check(vk_left);
    jkey = keyboard_check(vk_up);

    // Check for ground
    if (place_meeting(x, y+1, obj_solid))
    {
    vspd = 0;
    // Jumping
    if (jkey)
    {
    vspd = -jspd;
    }
    }
    else
    {
    // Gravity
    if (vspd <10)
    {
    vspd += grav;
    }
    }

    // Moving right
    if (rkey)
    {
    hspd = spd;
    }

    // Moving left
    if (lkey)
    {
    hspd = -spd;
    }

    // Check for not moving
    if ((!rkey && !lkey) || (rkey && lkey))
    {
    hspd = 0;
    }

    // Horizontal collisions
    if (place_meeting(x+hspd, y, obj_solid))
    {
    while (!place_meeting(x+sign(hspd), y, obj_solid))
    {
    x+= sign(hspd);
    }
    hspd = 0;
    }

    // Move horizontally
    x += hspd;

    // Vertival collisions
    if (place_meeting(x, y+vspd, obj_solid))
    {
    while (!place_meeting(x, y+sign(vspd), obj_solid))
    {
    y+= sign(vspd);
    }
    vspd = 0;
    }

    // Move vertically
    y += vspd;

  8. need some help, my player won't move left, I've followed the whole code, and double check, so If I could get a second pair of eyes to view it and maybe see what I may have did wrong,

    ////Here is my code:

    //Plat Form Script

    var rkey = keyboard_check(vk_right);
    var lkey = keyboard_check(vk_left);
    var jkey = keyboard_check(vk_space);

    if (place_meeting(x, y+1, obj_solid)){
    vsdp =0;

    //Jumping
    if (jkey) {
    vspd = -jspd;
    }
    }else{
    if (vspd < 10) {
    vspd += grav;
    }
    }

    //Move right
    if (rkey){
    hspd = spd;
    }
    //move left
    if (lkey){
    hspd = -spd;
    }

    //check for not moving
    if ((!rkey && lkey) || (rkey && lkey)) {
    hspd = 0;
    }

    //Horizontal collisions
    if (place_meeting(x+hspd, y, obj_solid)) {
    while (!place_meeting(x+sign(hspd), y, obj_solid)) {
    x += sign(hspd)
    }
    hspd= 0;
    }
    x += hspd;

    //Vertical collisions
    if (place_meeting(x, y+vspd, obj_solid)) {
    while (!place_meeting(x, y+sign(vspd), obj_solid)) {
    y += sign(vspd)
    }
    vspd= 0;
    }
    y += vspd;

  9. I'm not sure what the differences between yours and mine are, but actually using the full variable terms:
    gravity
    speed
    hspeed
    vspeed
    jspeed

    instead of:
    grav
    spd
    hspd
    vspd
    jspd

    is what fixed my issues. Is there some sort of setting you have in the scripts or variables you already created or whatever that read those shortened terms the same way as the original terms?
    (btw I know this video is old and everything, but I'm just curious as to what exactly you did)

  10. If you jump and keep going up, or you don't do anything after hitting your head on a solid…I noticed there's another bracket behind the else for gravity…I had it in front XD so {vspd=-jspd}} else {if (vspd<10){vspd+=grav}}; . Also make sure your variables are set to the right numbers upon create.

  11. No clue what I did wrong

    /// platform physicas

    var rkey = keyboard_check(vk_right);

    var lkey = keyboard_check(vk_left);

    var jkey = keyboard_check (vk_space);

    ///Gorund Check

    if (place_meeting(x,y+1,ground)) {

    vpd = 0;

    ///jumping

    if (jkey) {

    vspd = -jspd;

    }

    } else {

    //grav

    if (vspd <10) {

    vspd += grav; }

    }

    ///moving right

    if (rkey) {

    hspd = spd;

    }

    ///moving left

    if (lkey) {

    hspd = -spd; }

    ///check if not moving

    if ((!rkey && !lkey) || (rkey && lkey)) {

    hspd = 0;

    }

    ///horizpntial collisions

    if (place_meeting(x+hspd,y,ground)){

    while (!place_meeting(x+sign(hspd),y,ground)){

    x+= sign(hspd);

    }

    hspd = 0;

    }

    ///move horizontially

    x+= hspd;

    /// vertical collisions

    if (place_meeting(x, y+vspd,ground)){

    while (!place_meeting(x,y+sign(vspd), ground)){

    y += sign(vspd);

    }

    vspd = 0;

    }

    /// now wvert

    x+= vspd;

  12. I know this video is old but I just watched it and for some reason my character will move left and right but won't jump. I'm sure I have some obvious mistake but I can't seem to find it. Here's my code:

    Create Event:
    ///Initialize Variables

    grav = 1;

    spd = 4;

    jspd = 12;

    hspd = 0;

    vspd = 0;

    Step Event:
    /// Platform Physics

    var rkey = keyboard_check(vk_right);

    var lkey = keyboard_check(vk_left);

    var jkey = keyboard_check(vk_up);

    //Check for the Ground

    if (place_meeting(x, y+1, obj_solid)) {

    vspd = 0;

    //Jumping

    if (jkey) {

    vpsd = -jspd;

    }

    } else {

    // Gravity

    if(vspd < 10) {

    vspd += grav;

    }

    }

    //Move right and left

    if(rkey) {

    hspd = spd;

    }

    if(lkey) {

    hspd = -spd;

    }

    //Check for not moving

    if((!rkey && !lkey) || (rkey && lkey)) {

    hspd = 0;

    }

    // Horizontal Collisions

    if(place_meeting(x+hspd, y, obj_solid)) {

    while(!place_meeting(x+sign(hspd), y, obj_solid)) {

    x+= sign(hspd);

    }

    hspd = 0;

    }

    x += hspd;

    // Vertical Collisions

    if(place_meeting(x, y+vspd, obj_solid)) {

    while(!place_meeting(x, y+sign(vspd), obj_solid)) {

    y+= sign(vspd);

    }

    vspd = 0;

    }

    y += vspd;

Trả lời

Email của bạn sẽ không được hiển thị công khai.