• 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!

GML Switching sides of sprite

doomtucan

Member
yes i can walk but i want when my mouse is on the left side the sprite switches to facing left and then when mouse is on right it faces right..i cant seem to figure that out...any help would be great
 

Slyddar

Member
Simple answer,
GML:
if sign(mouse_x - x) != 0 image_xscale = sign(mouse_x - x);
Better answer,
Add a facing variable in the create event which is -1 or 1 for facing left or right. Do the same as above, but use facing instead of image_xscale. Add a draw event and draw_sprite_ext with facing where image_xscale argument goes.
 
Top