Sprite Issue (How To Center It)

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
Dollarluigi
Regular
Posts: 63
Joined: Mon Aug 15, 2016 10:06 pm
Completed: Winter Dream, School For The Friendless
Tumblr: Rehnchoro
Deviantart: Dollarluigi
Skype: Dollarluigi
Soundcloud: Dollarluigi
Location: Probably Earth
Contact:

Sprite Issue (How To Center It)

#1 Post by Dollarluigi » Sat Mar 11, 2017 11:20 pm

I've been looking up how to get the proper sprite size and I found something that worked but it had the image too far off to the left. Is there any way I can center the image...?

My code looks something like this. What numbers would be useful here...?

Code: Select all

show sprite:
        yanchor n
        ypos n
        xanchor n
        xpos n
Suffering a rare condition is one of the worst things you could ever experience because no one understands a thing.

YouTube Twitter Tumblr Reddit deviantArt

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Sprite Issue (How To Center It)

#2 Post by Ocelot » Sun Mar 12, 2017 1:21 am

You can pass floating point values to *pos/*anchor. It will set position/anchor as a fraction of screen/image size. Also you can use *align to set both position and anchor at once:

Code: Select all

show sprite:
    yalign 0.5
    xalign 0.5
# OR
show sprite at truecenter
< < insert Rick Cook quote here > >

User avatar
Dollarluigi
Regular
Posts: 63
Joined: Mon Aug 15, 2016 10:06 pm
Completed: Winter Dream, School For The Friendless
Tumblr: Rehnchoro
Deviantart: Dollarluigi
Skype: Dollarluigi
Soundcloud: Dollarluigi
Location: Probably Earth
Contact:

Re: Sprite Issue (How To Center It)

#3 Post by Dollarluigi » Sun Mar 12, 2017 11:41 pm

Thanks for the help, but I figured out another way to fix this yesterday and forgot to say something. XD
Suffering a rare condition is one of the worst things you could ever experience because no one understands a thing.

YouTube Twitter Tumblr Reddit deviantArt

Post Reply

Who is online

Users browsing this forum: Bing [Bot]