Center of Viewport?

0 favourites
  • 10 posts
  • When you rotate a Layer or a Layout, it seems to me, that the rotation origin is allways the center of the viewport. Am I right?

    If so, what is the best way to center the background image of a layout with say a size of 1200x1200 and a viewport of 800x600...

    ...or to put it another way, how do I rotate this big layer with the smaller viewport so that the rotation center is the center of the background?

  • It seems to me that the center of rotation is the center of the layout.

    If your layout is as big as your window, yes, window and layout share the same center.

    In a layout of 1200X1200 the center will be 600X600.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have a look -> CAPX

  • Use the CAPX. Set the Avatar to "inmovable" an then run the file. Rotate the Layer with the Arrow-Keys.

    Since the Avatar is the middle of the Viewport, the layer rotates around him. Now change the position of the Avatar an run the file again....

  • Apparently you're right, layers seem to rotate around scrollX and ScrollY.

    That is still confusing me though.

    Allowing to let the user define the rotation center of the layers has been asked.

    Let's hope Ash could allow it in the next release.

  • Viewport is the operative word here. The way it is now rotate layer, and rotate layout are actually a rotation of the view, not the layer/ layout.

    Think of it as the camera, scrollto is telling the camera to focus on the character, and the arrow keys tell the camera to rotate.

    The work around(... well not really a work work around, this is just how it works), is to manually set the scroll.x, and scroll.y in events, and not use the scrollto behavior.

  • Thanks you twi :-)

    Newt...I'll try that

  • You could try setting the parallax for the layer you rotate to 0. Then position everything in the top-left of the layout and it will always rotate about the center of the screen.

  • newt - that did the trick! Cheers Mate!

  • I'm trying to follow along here, but I'm a tad confused...

    First, I'm not sure if this was the same issue Weishaupt had, but I'll explain my situation...

    I want to have two control types. The more traditional way which is to have the layout/layer in a fixed view. It doesn't rotate while the 8Direction behavior makes the character turn every which way.

    Alternatively, the second option is to have the character in a fixed angle, while the layout/layer rotates respectively...similar to MODE7 on the Super Nintendo.

    I am thinking I could manipulate the Set Angle action for the layer by adjusting it relative to the angle of the character. However, so far I cannot think of a way to do this since I'm figuring I have to set the angle of the character to a constant of 270 (or whatever I choose).

    Any suggestions/clarifications?

    Thanks!

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