Center of Viewport?

Get help using Construct 2

Post » Fri Jan 13, 2012 7:34 pm

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?
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Fri Jan 13, 2012 7:55 pm

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Jan 13, 2012 8:08 pm

Have a look -> CAPX
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sat Jan 14, 2012 8:52 am

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....
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sat Jan 14, 2012 9:43 pm

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Sat Jan 14, 2012 10:01 pm

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.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sun Jan 15, 2012 9:25 am

Thanks you twi :-)

Newt...I'll try that
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sun Jan 15, 2012 12:54 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Sun Jan 15, 2012 1:43 pm

@Newt - that did the trick! Cheers Mate!
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Tue Dec 03, 2013 9:32 pm

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!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Next

Return to How do I....?

Who is online

Users browsing this forum: CavalierBubble and 19 guests