# Solved. How do I limit rotation ?

Get help using Construct 2

### » 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
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

### » Sat Jun 11, 2016 12:56 pm

clamp(angle,45,155)
B
175
S
50
G
199
Posts: 8,624
Reputation: 124,024

### » 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

### » 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.
B
175
S
50
G
199
Posts: 8,624
Reputation: 124,024

### » 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

### » Sat Jun 11, 2016 2:22 pm

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

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

### » 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

### » 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

### » 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
246
S
136
G
12
Posts: 167
Reputation: 25,965

### » 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.
B
175
S
50
G
199
Posts: 8,624
Reputation: 124,024

Next