Strafe

Get help using Construct 2

Post » Sat Aug 04, 2012 4:40 am

I'm working on a helicopter game and thought it would be cool to add the ability to strafe left and right.

I'm not totally sure how to do this since it will depend on the angle the chopper is currently at as to how the x,y will change. Is there a math equation that does this anywhere?

Thanks :)

Ed
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sat Aug 04, 2012 5:40 am

In short:
for x position you need to refer to Cos(heli.angle)
and for y position: Sin(heli.angle)

Sin and Cos basically generate a number between 1 and -1 depending on the angle given.

https://dl.dropbox.com/u/53374990/helirelative.capx
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Sat Aug 04, 2012 6:04 am

Thank you.

The link is broken though.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sat Aug 04, 2012 6:19 am

wut.. :S can anyone else try the link and confirm that?
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Sat Aug 04, 2012 6:27 am

B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sat Aug 04, 2012 6:27 am

Weird, was just a chrome thing. Worked fine in firefox.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sat Aug 04, 2012 6:28 am

Confirmed - 404 (as above).
ImageImageImage
B
67
S
19
G
121
Posts: 3,196
Reputation: 72,879

Post » Sat Aug 04, 2012 6:29 am

OK, thanks for that. But what if I don't want it to rotate while strafing, but just continue on the straight path? Not sure if I am making sense.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sat Aug 04, 2012 6:33 am

hmm not sure If i know what you mean..
just to check, you are aware that the helicopter faces the direction of the mouse, right?
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Sat Aug 04, 2012 6:36 am

Yeah, right now I am not using the mouse to control. I'll try it that way and see. Thanks.

I was thinking of having a strafe left and strafe right button, but this might be better :)
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 30 guests