Lock facing

Get help using Construct 2

Post » Tue Aug 06, 2013 4:06 pm

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.
B
5
S
2
Posts: 53
Reputation: 792

Post » Tue Aug 06, 2013 4:47 pm

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.
B
5
S
2
Posts: 53
Reputation: 792

Post » Mon Jul 28, 2014 11:54 am

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.
Image

Any other ideas?

/Update 2:
This is the current movement code:
Image
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
56
S
17
G
6
Posts: 748
Reputation: 9,420

Post » Mon Jul 28, 2014 2:30 pm

Using the 8 directions movement, it's quite easy to implement a basic "strafing". See below :
You do not have the required permissions to view the files attached to this post.
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Mon Jul 28, 2014 3:51 pm

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.
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
56
S
17
G
6
Posts: 748
Reputation: 9,420


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 47 guests