rotating object, lock angle

Get help using Construct 2

Post » Sun Mar 31, 2013 4:19 pm

Does anyone know a proper way to do this:

The objects angle is 0.

Pseudo code:
When right key is held
---> rotate angle of object counterclockwise by 3

If angle of object is 306
---> then set angle 306

When right key is not held
---> rotate angle of object clockwise by 3

If angle of object is 360
---> then set angle to 360

Basically I want a turret that rotates to a specific angle when the right key is held and then lock to that angle, and if the right key is not held, then slowly go back to starting position by rotating to the opposite direction, then lock at that specific angle.

Anyone know how I can do this in Construct 2? Any help is appreciatedretrodude2013-03-31 16:20:04
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Sun Mar 31, 2013 4:31 pm

[if (Right Key) and angle < 306] Rotate Counterclockwise
[if (no right key) and angle > 0] Rotate Clockwise

I think that should work, let me know if it doesn't.
B
17
S
4
G
4
Posts: 143
Reputation: 4,004

Post » Sun Mar 31, 2013 7:22 pm

[QUOTE=ChrisAlgoo] [if (Right Key) and angle < 306] Rotate Counterclockwise
[if (no right key) and angle > 0] Rotate Clockwise

I think that should work, let me know if it doesn't.[/QUOTE]

It doesn't quite work, but it is working towards the right direction
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Sun Mar 31, 2013 7:53 pm

Something like this?

resetRotation.capx (r123.2)

B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Mar 31, 2013 8:34 pm

[QUOTE=Nimtrix] Something like this?

resetRotation.capx (r123.2)

[/QUOTE]

NICE! This is perfect, just what I was looking for. I appreciate it, thanks
B
18
S
4
G
3
Posts: 436
Reputation: 4,801


Return to How do I....?

Who is online

Users browsing this forum: Televangelist and 20 guests