Search code examples
game-maker

Changing direction of a sprite in Game Maker


I’m trying to make a racing game and I know that there’s a line of code that changes the direction of the sprite when a new key is pressed as I used it in a previous game (which I’ve seemed to of lost) and I was wondering if anyone knew what the piece of code was?


Solution

  • This code will set the angle of the sprite (I think this is probably what you're after):

    image_angle = 180; //whatever angle you need
    

    This code will flip a sprite so it is mirrored horizontally:

    image_xscale = -1;