How do I Rotate a Layer with a Different Center Point?

  • It seems, and maybe im wrong, that the Rotate Layer rotates the layer based on the center of the viewport as the origin point?

    Can i set where the origin point is exactly when rotating a layer? I basically want to rotate a layer around a circle but I want that circle to be off-set from the center of the screen. I want the circle's position to be static but its angle to change based on the layer rotation, but I want the circle to be half off-screen, so using something like 'scroll to' doesnt work since it centers the camera on the circle...

    Pinning / etc is not what Im looking for either...

  • I'm sure the effect you are trying to achieve can be achieved.

    instead of the scrollto behaviour there is also the system scrollto action,

    so maybe something like this would work?

    every tick

    system scrollto Circle.x+0.5*windowwidth, circle.y

  • I'm sure the effect you are trying to achieve can be achieved.

    instead of the scrollto behaviour there is also the system scrollto action,

    so maybe something like this would work?

    every tick

    >system scrollto Circle.x+0.5*windowwidth, circle.y

    Thanks - but yeah i tried that but it still offsets the shape so it still rotates around the center of the screen so now instead of the shape keeping its position, it is 'orbiting' the middle of the screen...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Heres a CAPX that hopefull helps illustrate what I want... I want the 'world' to rotate around the square (including the square...) but have the square actually locked to the bottom of the screen.

    Angle can change on the bottom of the screen--i dont want the square "always up" so i still want it to rotate like it does in the middle of the screen, but on the bottom of the screen and things moving around it proportionally as they do when the camera is centered on it...

    Here's a CAPX: http://d.pr/f/jObG/4cgLcYDD

  • In the new project dialog there is an example of a rotating platformer.

    It's worth a look I think.

    It set's the angle of the layer based on the angle between 2 objects, with some work you should be able to transfer this to your situation.

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