D
dawson2223
Guest
I changed my enemies sprite when they were hit with a bullet and set an alarm to reset it, but the alarm portion isn't working. Does anyone know what I forgot in my code?
Create Event:
hit = 0
Collision Event with obj_bullet:
hit = 1;
Step Event:
Alarm 2:
hit = 0;
----
I've tried putting the second part of the step event in alarm 2 but that didn't work either. Not sure why it isn't resetting. Help Please
Create Event:
hit = 0
Collision Event with obj_bullet:
hit = 1;
Step Event:
Code:
/// Enemy Flash when Hit
if (hit = 1 && sprite_index = spr_EnemyRunUp) {
sprite_index = spr_HitUp;
alarm[2] = 10
}
if (hit = 1 && sprite_index = spr_EnemyRunDown) {
sprite_index = spr_HitDown;
alarm[2] = 10;
}
if (hit = 1 && sprite_index = spr_EnemyRunRight) {
sprite_index = spr_HitRight;
alarm[2] = 10;
}
if (hit = 1 && sprite_index = spr_EnemyRunLeft) {
sprite_index = spr_HitLeft;
alarm[2] = 10;
}
if hit=0 {
if sprite_index = spr_HitUp{
sprite_index = spr_EnemyRunUp
}
if sprite_index = spr_HitDown{
sprite_index = spr_EnemyRunDown
}
if sprite_index = spr_HitLeft{
sprite_index = spr_EnemyRunLeft
}
if sprite_index = spr_HitRight{
sprite_index = spr_EnemyRunRight
}
}
hit = 0;
----
I've tried putting the second part of the step event in alarm 2 but that didn't work either. Not sure why it isn't resetting. Help Please