[SOLVED] Custom Anchor Point for a Rotation?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

[SOLVED] Custom Anchor Point for a Rotation?

#1 Post by Katy133 » Thu Mar 24, 2016 5:32 pm

How do you change an image's rotation point so that it doesn't rotate from it's centre?

I've used:

Code: Select all

show rocking_horse:
        easeout 0.5 rotate -30
        easein 0.5 rotate -45
        easeout 0.5 rotate 30
        easein 0.5 rotate 45
        easeout 0.5 rotate 15
        easein 0.5 rotate 0
... Which has the image rotate at it's centre. I'm trying to make it rotate from nearer bottom of the image. I've been searching and searching for the right term, but all the experimenting I've done hasn't changed the anchor point.
Last edited by Katy133 on Thu Mar 24, 2016 7:02 pm, edited 1 time in total.
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Custom Anchor Point for a Rotation?

#2 Post by xela » Thu Mar 24, 2016 5:53 pm

With ATL, you'll have to combine rotation and circle motion for this, it'll require a good grasp on both and a tiny little bit of visualization skills to under what's required to get the desired result.
Like what we're doing? Support us at:
Image

Onishion
Veteran
Posts: 295
Joined: Mon Apr 20, 2015 10:36 am
Contact:

Re: Custom Anchor Point for a Rotation?

#3 Post by Onishion » Thu Mar 24, 2016 6:18 pm

There is an easier way to do it, which I stumbled upon. Basically you change where the actual center of the image is. I really wish you could just move the "rotation point" of the image around, but you can't. There is a workaround though. Let's say that you want to make a planet that is in orbit around a sun, right? Let's say that your planet image is a 25x25 pixel image. If you wanted that image to rotate around a fixed point that is 100 pixels away from it, then one easy way to do it is to just edit the image so that instead of just being the planet, it is instead a 25x250 pixel image (25 for the planet, 25 for an imaginary planet on the opposite side, and 100x2 for the distance you want it to rotate), with the planet at the very bottom (or top, whichever), and the rest being transparent space.

This will cause the visible portion of the image to rotate around the invisible center of the image. You can also fake this by making a LiveComposite that just contains the image, and in the image size brackets just give it whatever size you'd need to achieve the desired results. There might be even simpler ways of defining the image to have a "fake" size to it, but I haven't tested them so you can try to figure those out yourself, but that's my basic method, change the size Renpy thinks the image is so that the dead center of that image is where you want the rotational axis to be.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Custom Anchor Point for a Rotation?

#4 Post by xela » Thu Mar 24, 2016 7:25 pm

Onishion wrote:There is an easier way to do it
Nice one! It's definitely simpler for anyone who doesn't have a good grasp on atl.
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: Alex, Google [Bot], nyeowmi