T2008
Member
I'm having trouble with my animation not stopping at the end of animation event though I set the say image_index = -1; The death animation just keeps playing. The relevant code is below (I omitted the hit code/hitbox/alarms - I can post if needed). Any ideas would be greatly appreciated! I'm sure it's probably something stupid I'm overlooking.
Step Event:
Animation End Event:
Step Event:
Code:
//Set Sprite
//---Hit
if (!enemy_dead) && (hit) && (hp > 0) {
sprite_index = spr_robot_melee_static_hit;
}
//---Not Hit
if (!enemy_dead) && (!hit) && (hp > 0) {
sprite_index = spr_robot_melee_static;
}
//---Dead
if (hp <= 0) {
sprite_index = spr_robot_melee_static_die;
enemy_dead = true;
}
if (enemy_dead) {
if (!death_sound_played) {
audio_play_sound(snd_enemy_die,10,false);
}
death_sound_played = true;
enemy_disappear_clock -=1;
}
//Destroy If Clock Has Run
if (enemy_disappear_clock <= 0) {
instance_destroy();
}
Code:
//Stop Die Animation
if (sprite_index = spr_robot_melee_static_die) {
image_index = -1;
}