Solved. How do I limit rotation ?

Get help using Construct 2

Post » Sat Jun 11, 2016 12:39 pm

I only want it from 45 until 155 degrees only before 45 and after 155 it cant rotate to below 44 or above 156 degrees :(
Image
Last edited by fathijack1999 on Sat Jun 11, 2016 3:56 pm, edited 1 time in total.
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Sat Jun 11, 2016 12:56 pm

clamp(angle,45,155)
Image ImageImage
B
171
S
50
G
180
Posts: 8,396
Reputation: 113,986

Post » Sat Jun 11, 2016 12:59 pm

newt wrote:clamp(angle,45,155)

clamp ? Can write an example
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Sat Jun 11, 2016 1:15 pm

clamp(yourvalue,minimum,maximum)
I don't know what yourvalue is.
Its part of the question that you have to provide.
Image ImageImage
B
171
S
50
G
180
Posts: 8,396
Reputation: 113,986

Post » Sat Jun 11, 2016 1:56 pm

newt wrote:clamp(yourvalue,minimum,maximum)
I don't know what yourvalue is.
Its part of the question that you have to provide.

I mean where to put clamp at systemor at the sprite
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Sat Jun 11, 2016 2:22 pm

clamp is an expression you can write expressions on the edit box that appears on the screen

Image
Image
B
28
S
11
G
2
Posts: 139
Reputation: 3,299

Post » Sat Jun 11, 2016 2:34 pm

fathijack1999 wrote:
newt wrote:clamp(yourvalue,minimum,maximum)
I don't know what yourvalue is.
Its part of the question that you have to provide.

I mean where to put clamp at systemor at the sprite

sprite>rotate clamp(self.angle,50,150)
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Sat Jun 11, 2016 3:56 pm

granpa wrote:
fathijack1999 wrote:
newt wrote:clamp(yourvalue,minimum,maximum)
I don't know what yourvalue is.
Its part of the question that you have to provide.

I mean where to put clamp at systemor at the sprite

sprite>rotate clamp(self.angle,50,150)

Well thanks but i found "Is between can be it to just it still don`t look cool but it`s work . But I will try to understand what is the action you write for so thank you
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Sat Jun 11, 2016 10:42 pm

The heck? It's that simple to accomplish this?

I was working on something long ago that involved limited rotation, and all I needed was a 'clamp' expression? I'm looking to have an object only rotate between pressing LEFT to 82 degrees, and pressing RIGHT to 278 degrees and never going past those numbers.

Are there any tutorials that show examples of what every single expression can perform in the events?
B
223
S
125
G
8
Posts: 146
Reputation: 22,243

Post » Sat Jun 11, 2016 11:18 pm

https://www.scirra.com/manual/126/system-expressions
The manual does a decent job of getting the basic meaning, as does the editor when you use the dialog box's.
The how do I section should get most everything else.
Image ImageImage
B
171
S
50
G
180
Posts: 8,396
Reputation: 113,986

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests