P
Palocles
Guest
Hopefully this is simple, I don't want to spam the forum with questions...
So i've got a state engine and need a couple of states to run multiple sprites. This works ok for jump where a different sprite is running for upwards movement to the downwards movement sprite (if/else) statement.
I'm running into trouble with my attack state. Ultimately i want to be able to string two (or more) different attack animations together for rapid attacks (combo, if you will) without returning to a neutral (idle) state in between. So the attack animations do not include the final few frames which would return the player sprite to the neutral position, allowing attack B to immediately follow attack A.
In the mean time, for this more simple state engine, I want the 'return' animation to follow attack A and then return to idle, but its not leaving the attack state anymore.
original code which returns to idle correctly:
It seems that this nested statement should perform like the original code did but it doesn't for some reason.
So i've got a state engine and need a couple of states to run multiple sprites. This works ok for jump where a different sprite is running for upwards movement to the downwards movement sprite (if/else) statement.
I'm running into trouble with my attack state. Ultimately i want to be able to string two (or more) different attack animations together for rapid attacks (combo, if you will) without returning to a neutral (idle) state in between. So the attack animations do not include the final few frames which would return the player sprite to the neutral position, allowing attack B to immediately follow attack A.
In the mean time, for this more simple state engine, I want the 'return' animation to follow attack A and then return to idle, but its not leaving the attack state anymore.
GML:
function scrPlayerAttack(){
show_debug_message("entered Attack State");
sprite_index = sprBoganAttack;
image_xscale = currentFacing;
if(image_index >= (image_number -1))
{
sprite_index = sprBoganAttackEnd;
if(image_index >= (image_number -1))
{
show_debug_message("leaving Attack State");
currentState = playerState.idle;
}
}
}
Code:
function scrPlayerAttack(){
show_debug_message("entered Attack State");
sprite_index = sprBoganAttack;
image_xscale = currentFacing;
if(image_index >= (image_number -1))
{
show_debug_message("leaving Attack State");
currentState = playerState.idle;
}
}
Last edited by a moderator: