Lock facing

0 favourites
  • 5 posts
  • I'm sure I must be overlooking a simple way of doing this. I'm making a top-down shooter with 8-way movement but I'd like for the player to be able to use a particular key to lock the facing. In other words, when they are holding down that key they will still be able to move as normal but their facing will be locked at the angle it was when they pressed the key, effectively strafing.

    Any help would be greatly appreciated.

  • It's okay - I figured it out! I just set a variable to player.angle when the key was pressed then had the facing set to that variable while the key was held down.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi. Did you use 8direction movement or the car behavior?

    I tried to implement "strafing" (moving left/right while still moving forward towards mouse position) but it's not really working, yet.

    I used Every Tick > Rotate x Degrees to MouseX, MouseY to keep the player always looking toward the cursor position. But with 8Dir the player moves just left/right regardless of angle and with car only steering (more rotation) is possible?

    How can you make the player just move left/right while keeping it moving forward towards the mouse position?

    /Update: I tried Custom Movement and it seemed to work fine first but the player object is drifting away/backwards.

    Any other ideas?

    /Update 2:

    This is the current movement code:

  • Using the 8 directions movement, it's quite easy to implement a basic "strafing". See below :

  • I will try it, thanks. But it seems the current code above works if you set "Unbounded Scrolling" of the Layout to true and keep the player in the middle of the screen with the ScrollTo Behavior.

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