I wrote:make a variable called DIR, make it an actor variable not global.
put this on the draw actor event of you're enemy
- Code: Select all
if(xvelocity < 0)DIR = 0;
if(xvelocity > 0)DIR = 1;
when he is supposed to shoot,
- Code: Select all
if(DIR == 1 && player.x > x) {
create the shot;
}
if(DIR == 0 && player.x < x) {
create the shot;
}
I hope that helps.
that is the code to use xD
only I wrote it as make him shoot,
which is creating the shot,
that code has to work I used it for my spear dudes in Samurai Dude so they would not throw the spears backwards, same with the whip dude so he would not attack backwards