B
buddhajuggles
Guest
The issue I'm having is that my animation is freezing on image_ index = 0 ,
The initial sprite in use is made up of only one image ( spr_enemy) and in the code I switch it out for
spr_EnemyBP which is made
up of two images. The switch is made by a boolean variable that is set to true when my enemy is at a certain range of my player.
The code works in that the boolean is set to true and the sprite change does happen but the
Issue being the animation switch is stuck on the first frame. I changed spr_enemy out for a 2 image
animation and then the preceding animation did work. What bit of code am I missing ? I tried setting image_index to 0
because I read somewhere that would help but it did not. Is there a convention I have yet to learn regarding
sprites of different lengths? The code is below with the sprites in bold.
if( Hit == false && Hit2 == false && Down==false && CurrentHp > 0)
{
sprite_index = spr_enemy; // if I change to a sprite_index that has the same sub images as spr_EnemyBP it works
if (distance_to_object(obj_Player) < .25 && abs(y - obj_Player.y) < .75)
{
isAttacking = true ;
}
}
if ( isAttacking = true) { sprite_index = spr_EnemyBP } // tried setting image_index to 0
The initial sprite in use is made up of only one image ( spr_enemy) and in the code I switch it out for
spr_EnemyBP which is made
up of two images. The switch is made by a boolean variable that is set to true when my enemy is at a certain range of my player.
The code works in that the boolean is set to true and the sprite change does happen but the
Issue being the animation switch is stuck on the first frame. I changed spr_enemy out for a 2 image
animation and then the preceding animation did work. What bit of code am I missing ? I tried setting image_index to 0
because I read somewhere that would help but it did not. Is there a convention I have yet to learn regarding
sprites of different lengths? The code is below with the sprites in bold.
if( Hit == false && Hit2 == false && Down==false && CurrentHp > 0)
{
sprite_index = spr_enemy; // if I change to a sprite_index that has the same sub images as spr_EnemyBP it works
if (distance_to_object(obj_Player) < .25 && abs(y - obj_Player.y) < .75)
{
isAttacking = true ;
}
}
if ( isAttacking = true) { sprite_index = spr_EnemyBP } // tried setting image_index to 0
Last edited by a moderator: