top of page
finished book.png
big piece of paper.png
big piece of paper.png

Since the game has obstacals and the character can die to spikes and water, I needed to add a checkpoint and respawn system to the game so that the player wouldn't lose all their progress if they died at the end of a level. I created check point areas that once the player collided with it would store their current coordinates. And then when the player dies it would set the location of the player to the new point rather than the beginning of the level. Due to the death animation, I had to use the image_index to time how long before the game starts again which meant disabling the players movement until the respawned.

programming box.png
programming box.png

var Death = place_meeting(x,y+1,oDeath);
var Respawn = place_meeting(x,y,oRespawn);

if(Respawn = 1)
{respawn_x = x; respawn_y = y;}

if (Death = 1)
{dying = true;
sprite_index = sPlayerDeath;
hsp = 0;
vsp = 0;

    if(image_index > 5)
   {
   x = respawn_x;
   y = respawn_y;
   dying = false;
   }
}

big piece of paper.png

This is where I am changing the sprites, it's very tedious and is basically just checking the direction of the player where they are and what they are touching.

If I had more time on this project I would of researched a plugin for changing the sprite under certain conditions.

programming box.png
programming box.png
programming box.png

if (onGround = 1 && move = 0 && lastpressed = "right")
{ image_angle = 0;
   sprite_index = sPlayerIdleR;}
   
   if (onGround = 1 && move = 0 && lastpressed = "left")
{ image_angle = 0;
   sprite_index = sPlayerIdleL;}

if(global.textbox = false)
{
if(onGround = 1 && move = 1)
{ image_angle = 0;
   sprite_index = sPlayerWalkinR;}
   
if(onGround = 1 && move = -1)
{ image_angle = 0;
   sprite_index = sPlayerWalkinL;}

}    
if(onWall = 1 && onGround = 0 && lastpressed = "left" && sprite_index != sPlayerSlide)
{    image_angle = 0;
   sprite_index = sPlayerWallL;}

if(onWallExtra = 1 && onGround = 0 && lastpressed = "right" && sprite_index != sPlayerSlide)
{    image_angle = 0;
   sprite_index = sPlayerWallR;}

if(!onWall = 1 && !onGround = 1 && sprite_index = sPlayerWallL)
{sprite_index = sPlayerJumpL;}
if(!onWallExtra = 1 && !onGround = 1 && sprite_index = sPlayerWallR)
{sprite_index = sPlayerJumpR;}

bottom of page