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

Get help using Construct 2

Post » Tue Apr 14, 2015 11:50 pm

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...
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Post » Tue Apr 14, 2015 11:58 pm

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Apr 15, 2015 12:04 am

LittleStain wrote: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...
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Post » Wed Apr 15, 2015 12:10 am

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
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Post » Wed Apr 15, 2015 9:10 am

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: David181, marcinkowski, OBLIVION and 58 guests