M
mamacato
Guest
Often you'll see image_index = 0 while vertical speed < 0, then image_index = 1 on the way down. I want the same image_index for the up and down animation (simple to resolve), but I'd like a different image_index for either the on_the_ground frame (y collision), or for a couple frames before that, including the on_the_ground frame. Maybe I have to go through putting player_landed_state in my player state machine, but I'm wondering if there's something else that can be done within the animation script shown below.
If contribution { Thanks! }
Code:
sprite_index = sprites_array[state];
mask_index = mask_array[state];
image_xscale = facing;
switch(state)
{
case states.JUMP:
if vsp < 0 image_index = 0 else image_index = 1;
break;
case states.ATTACK:
if !on_ground() sprite_index = sPlayerAttackAir; //AttackAir
else
if hsp != 0 sprite_index = sPlayerAttackWalk; //AttackWalk
else sprite_index = sPlayerAttack; // Attack (only)
break;
case states.HURTING:
if !on_ground()
{
sprite_index = sPlayerJump;
if vsp < 0 image_index = 0 else image_index = 1;
}
break;
}