Have character face mouse cursor independent of movement key

0 favourites
  • 4 posts
From the Asset Store
Mouse cursor is something that the player controls and sees all the time, that's why it is so important to make it cool!
  • I have a character that uses the template for WASD movement. So he moves right/left etc. But I want him to always look in the direction where the mouse is (left or right) on a platform game.

    So if I press A key to move left and have mouse cursor on the right side he should go backwards.

    Right now he faces the way you press the keyboard.

    How do I do this?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • In the 8 direction properties (you're using 8 direction behavior right?), turn off the "set angle" property. Then add an event: every tick, set player angle towards mouse.x, mouse.y.

  • That makes my character look up and down and hes being rotated. I just want him to look left and right.

    If the mouse is on left side he should be mirrored and right side normal.

    If you played Starbound, the same way.

  • That makes my character look up and down and hes being rotated. I just want him to look left and right.

    If the mouse is on left side he should be mirrored and right side normal.

    If you played Starbound, the same way.

    Then simply change the character animation [or width to negative] depending on the x coordinates of your mouse and sprite.

    mouse.x > sprite.x | sprite faces right [or set width to default width]

    mouse.x < sprite.x | sprite faces left [or set width to negative default width]

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)