• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Making the enemy flips

Kami

Member
Hey, lately, I´ve been working on a game for a Game Jam, it´s a roguelike style game.

I have my enemy, who just have one sprite turning to the left, and I would like to:

Detect if the player is on his left or his right;

And flip to the side where the player is;
 
G

Gillen82

Guest
In the enemy step event

GML:
if(obj_player.x < x)
{
    image_xscale = -1;
}
else
{
    image_xscale = 1;
}
That will get you started
 
Top