How do I limit the angles of which a sprite rotates?

Get help using Construct 2

Post » Sat Nov 07, 2015 2:00 am

At the moment I have Every Tick > Sprite > Set angle towards mouse.x mouse.y
The only problem is this is 360 degrees, I would like to limit the angle it moves.
What I tried was If sprite is inbetween two angles > set angle towards mouse.x mouse.y but when you moved the mouse out of these two angles it stopped moving altogether.
B
8
S
1
Posts: 14
Reputation: 499

Post » Sat Nov 07, 2015 9:01 am

Image
will limit the angle to between -45 was 45° pointing at the mouse.

Or do you mean limit the speed? In which case look at "rotate towards".
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Mon Nov 09, 2015 2:44 am

Thank you, worked perfectly!
B
8
S
1
Posts: 14
Reputation: 499

Post » Mon Nov 09, 2015 4:32 pm

i should have said that the local variable (lvAngleToMouse) is certainly not needed in this example - but it does make the listing easier to read :)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest