Okay, let me see if I can break down the code. Again I apologize if I make a mistake, I’m still learning this as well.
The first IF statement:
If (!place_meeting(x,y+1, Owall)
This states that if the sprite(Chester) is not touching the ground go to the subroutine below. The subroutine is as follows:
{
sprite_index = SplayerA;
image_speed = 0;
if (sign(vsp) > 0) image_index = 1; else image_index = 0;
}
This code follows the IF statement. If the sprite going up in the air, use the jumping picture. If not, than use the falling picture.
Now to follow up the original IF statement is the ELSE statement:
else
{
image_speed = .125;
if (hsp == 0)
{
sprite_index = Splayer;
}
else
{
sprite_index = SplayerR;
}
}
What this states is that if the character is not in the air, run this routine. This routine sets the animation speed, and if the sprite is moving switch to the run GIF.
Lastly there was this little bit of code:
if (hsp != 0) image_xscale = sign(hsp);
This line of work cut my work in half. If you noticed up top Chester is running to the right. I didn’t need to animate him running to the left because of this code. What it this line states is flip the animation depending on which direction he is running.
Next I will be adding a weapon system, so good ol’ Chester will have arms. Stay tuned!