Day 1 in the bag


Well ya learn something everyday, thanks to Red for mentioning this DevBlog widget.

Comments

Log in with itch.io to leave a comment.

(1 edit)

Final code for Player [ Step ]   Walk + Jump Animations

/// @description Player Collision with walls
// Assign direction variables
key_left = keyboard_check(ord("A"));
key_right = keyboard_check(ord("D"));
key_jump = keyboard_check_pressed(vk_space);
// Moving
var _move = key_right - key_left ;
hsp = _move * walksp;
vsp = vsp + grv;
// Jumping
if (place_meeting(x,y+1,oWall)) && (key_jump)
{
    vsp = -jumpsp;    
}
// Horizontal  Collision  ( Moving Left <> Right )
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   ( Falling for Jumping )
if (place_meeting(x, y+vsp, oWall))
   {
   while (!place_meeting(x,y+sign(vsp),oWall))
       {
           y = y + sign(vsp);
       }
       vsp = 0;
   }
y = y + vsp;
   
// Animation
if (!place_meeting(x,y+1,oWall))
    {
        sprite_index = sPlayerA;
        image_speed = 0;
        if (vsp > 0) image_index=1; else image_index=0;
    }
    else
    {
        image_speed =1;
        if (hsp == 0)
        {
            sprite_index = sPlayer;    
            
        }
        else
        {
            sprite_index = sPlayerR;
        }
    }
if (hsp !=0 ) image_xscale = sign(hsp);

Todo [ 03/10/2020 ] for today is done

  • Create new project in Game Maker 2
  • Prepare default screen ( background, floor,  player )
  • Add gravity
  • Add code to get character moving, running, jumping

I figured it made sense to start clean and take my time to build each section properly and then add features after the fact.   i'll post my updates here going forward and leave comments to the comments page.