T
trentallain
Guest
Hi, my attack animation appears to play correctly when the image_speed (normalspeed) is set to 1, but not if it is set to 0.1. So confused as to why this is happening haha.
The correct animation for the attack number is only played for 2 frames and then it switches to the attack1 animation.
statecreate is set to true when the state is changed to the attack state. Basically the "create event" for the state.
statereset works with the animation end event to reset states when the animation has ended:
Step:
The correct animation for the attack number is only played for 2 frames and then it switches to the attack1 animation.
statecreate is set to true when the state is changed to the attack state. Basically the "create event" for the state.
statereset works with the animation end event to reset states when the animation has ended:
Code:
if statereset == true {
state = shieldstate.idle;
statereset = false;
randomidle = irandom_range(1,3);
}
Code:
// Reset attack number
if attackresettimer > 0 {
attackresettimer -= 1;
}
else {
attacknumber = 1;
}
////////////////////////////////// Finite states so other case code is irrelevant
// Attack - Can only be cancelled by rolling or getting hit
case shieldstate.attack:
if statecreate {
hsp = attacklungespeed * directionfacing;
image_index = 0;
if attacknumber == 4 {
hsp = (attacklungespeed * 1.5) * directionfacing;
attacknumber = 1;
}
else {
attacknumber += 1;
attackresettimer = 1.2 * room_speed; // 1.2 seconds to attack without the combo ending
}
statecreate = false;
}
sprite_index = asset_get_index("spr_shield_attack"+string(attacknumber));
image_speed = normalspeed;
// Wait for the animation to end
statereset = true;
// Change states
if keyroll {
statereset = false; // cancel whatever the attack state was doing
state = shieldstate.roll;
statecreate = true;
}
break;
/////////////////////////////////////