How do I rotate object by angle loop

  • Hello,

    I was trying to build something simple. Camera that moves within the defined angle range. Lets say, I have a camera and I want it to look through the area of 40 degrees, so it will move from 0 degrees to 40 degress wait 1 second and go back to 0 degress and then repeat this process endless times.

    Here is what I've done, I've made a system repeat that every 3 seconds Sprite 1 will set its angle to 20 degrees wait 1 second and then set angle to 0 degrees.

    The issues is that it's not rotating at all, it just jumps between the states from 20 to 0 degrees and I want the came to rotate slowely.

    How can this be done?

  • Rotate toward angle

    Rotate the object a number of degrees toward another angle. If the object is close to the target angle it will not overshoot (it will end up exactly at the target angle).

    Try this instead of setting your sprite angle

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I assume this is what you've been suggesting:

    Only the first time is doing it the right way, after that it starts to twitch for 1/2 degrees every secound or so.

  • after sprite rotate 10 degrees toward 0 add an action set variable rotate = 0

    I could explain how using the wait 0.5 second is not the smartest way to handle this ... but seeing as your in a learning curve ... I would just go with the rotate = 0 and follow up with events and actions after that

  • I've done something similar

  • like this?

    Thanks I'll look into this one too

  • > like this?

    >

    Thanks I'll look into this one too

    I've looked into your file, thanks that was great. However, I've a question about it.

    What if I make a square1, add drag and drop to your square2. Whenever I put square 2 overlapping square 1, square 2 should rotate by 15 degrees and then keep on with the rotation taking into account the 15 degree offset

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