R
Rosa.Hiru
Guest
I have a problem in which I cannot set sprite_index = spr_player_idle if hsp = 0, because that stops my spr_player_attack animation in the first frame. Thus, I have an issue where if i do the opposite the sprite will walk in place when hsp = 0. Is there a way to have the player sprite idle unless the attack button is pressed?
I also need the hitbox to appear after frame 5 of the attack animation, but if i try "if (image_index >= 5)" then i also have to fix the facing issue of where the hitbox appears. Here's the line of code:
I also need the hitbox to appear after frame 5 of the attack animation, but if i try "if (image_index >= 5)" then i also have to fix the facing issue of where the hitbox appears. Here's the line of code:
Code:
var xdiff;
var ydiff;
if (mouse_check_button_pressed(mb_left))
{
swordswing = true;
xdiff = x - xprevious;
ydiff = y - xprevious;
if (swordswing == true)
{
sprite_index = spr_player_slash
image_index += 0
if (sprite_index = spr_player_slash)
{
if image_index = 6
{
sprite_index = spr_player_idle;
image_index += 0;
swordswing = false;
}
}
}
if (!(xdiff == 0) && (ydiff == 0))
{
deltax = xdiff;
deltay = ydiff;
}
if (facing >= 0)
{
instance_create_layer(x + sign(deltax), y + sign(deltay) + 5, "Instances", obj_hitbox)
}
else
{
instance_create_layer(x + sign(deltax) - 80, y + sign(deltay) + 5, "Instances", obj_hitbox)
}
}