Solved. How do I limit rotation ?

  • 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

  • clamp(angle,45,155)

  • clamp(angle,45,155)

    clamp ? Can write an example

  • clamp(yourvalue,minimum,maximum)

    I don't know what yourvalue is.

    Its part of the question that you have to provide.

  • 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

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

  • > 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)

  • >

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

  • 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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Where do you put "sprite>rotate clamp(self.angle,50,150)"?

    Nevermind. I found it.

    For us new guys, when you pros give an answer, it might help if you state "In the event sheet, add a system event on every tick. Add a "set angle" action on the item you wish to clamp (such as player). Then enter sprite>rotate clamp(self.angle,225,315) and click done. That would have saved me a couple hours of feeling stupid

  • You can just type clamp, and the system will bring up the intellisense which gives you a selection of expressions you can use.

    A non modal menu will also pop when you get to the action of setting the angle.

    If you click on the system icon all the system expressions will appear, and you can select it from there, and fill it in manually.

    clamp(self.angle, 50,150) will make sure that the angle can only be within the arc of 50 to 150 degrees.

    Sprite.angle, or self.angle is the only value that can vary.

    Would an example help?

  • I found that in the manual. The problem is, I didn't have a clue what that expression meant. Nor did I know how to add it to my player sprite. I looked everywhere. Then I finally found an example capx file

    That's the reason I have never got into programming with javascript or vb. Because when I run into a problem, I don't know what I need to search for. You have to know thousands of codes in order to be able to get anything done. And that's just so you know where to look for answers when things don't work.

    That is the problem I see here with Construct. Had I not stumbled onto this thread, I might still be looking for a way to stop my sprite from rotating. After searching for limit rotation I found I needed to use the clamp function. But it took me another hour or so to find where I needed to enter that line of uh hem... code.

    Oh, thanks by the way LOL. I WOULD still be looking if not for your help hehe.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)