[SOLVED] Centering a Rotating Background

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
illuminate001
Veteran
Posts: 412
Joined: Thu Jul 02, 2009 1:46 pm
Completed: DSGR, Let's MEAT Adam, Sexy Litter, Bara Boarders
Projects: Secret Project
Organization: Soulsoft Electronic Arts
Tumblr: soulsoftea
itch: soulsoftea
Location: Orlando, FL
Contact:

[SOLVED] Centering a Rotating Background

#1 Post by illuminate001 »

Hey all,

So my games default resolution is 1920 x 1080. I made an entire background that's supposed to rotate behind the sprite and it's dimensions are 2500 x 2200.

It's so much larger on purpose so that while it spins, no one will see any edges. I can get it to spin, but the placement is crazy and completely off center. How can I get this image to be in the center of a 1920 x 1080 screen, and how can I ensure it rotates from it's OWN center?

This is the code I have so far:

I define the background:

Code: Select all

image bg Bus001 = "Bus001.jpg"
I define the transformation:

Code: Select all

transform forward_spin:
        subpixel True
        rotate 0
        linear 60.0 rotate 360
        repeat
Use the image with the transformation

Code: Select all

            scene bg Bus001 at forward_spin
            with flashbulb
I'd appreciate some help :)
Last edited by illuminate001 on Mon Nov 06, 2017 11:24 pm, edited 1 time in total.
ImageImage
ImageImage

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Centering a Rotating Background

#2 Post by Divona »

Try:

Code: Select all

transform forward_spin:
    subpixel True
    rotate 0 xanchor 0.5 yanchor 0.5
    linear 60.0 rotate 360
    repeat
Completed:
Image

User avatar
illuminate001
Veteran
Posts: 412
Joined: Thu Jul 02, 2009 1:46 pm
Completed: DSGR, Let's MEAT Adam, Sexy Litter, Bara Boarders
Projects: Secret Project
Organization: Soulsoft Electronic Arts
Tumblr: soulsoftea
itch: soulsoftea
Location: Orlando, FL
Contact:

Re: Centering a Rotating Background

#3 Post by illuminate001 »

Hi Divona!

Yes thank you that basically worked. :P

However I had to fudge with the numbers to get it just right. I'm not sure why it works now, or how the numbers really affect it all, but here's the code if it helps others:

Code: Select all

transform forward_spin:
        subpixel True
        rotate 0 xanchor 0.21 yanchor 0.345
        linear 60.0 rotate 360
        repeat
ImageImage
ImageImage

Post Reply

Who is online

Users browsing this forum: No registered users