Renpy custom Positions changing randomly [closed]

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
minyan
Miko-Class Veteran
Posts: 630
Joined: Tue Feb 10, 2015 3:59 pm
Completed: Trial By Fire, Heartbaked, Ellaria, Plain, This My Soul, The Pretenders Guild
Projects: Arena Circus
Tumblr: minyanstudios
itch: harlevin
Contact:

Renpy custom Positions changing randomly [closed]

#1 Post by minyan »

Hello, I often have this problem and I'm finally asking instead of just giving up!
Every time I define a custom position, or transform for a sprite, each time the sprite is shown it's in a different place.
For example:

Code: Select all

init: 
 define cen = Position(ypos=900, xalign = 0.5)
And in the script:

Code: Select all

    show lune_ at cen
Each time I show the sprite, he'll be in a different location on the screen, even though it's the same position. I tried to do it with a transform:

transform cent:
ypos 900
xalign 0.5

And had the same problem. I'll test it with multiple sprites, and they'll all be in the correct position, and then the next time they're shown in the script with that same code, they'll be on the other side of the screen, or very low, or very high. It's so odd, does anyone have any idea what I'm doing wrong?

Literally if I put:

Code: Select all

show lune_ at cen 
"..."
hide lune_ 
show lune_ at cen 
That second time the sprite is shown, he's in a drastically different location.
Last edited by minyan on Fri Nov 11, 2022 2:58 pm, edited 1 time in total.
ImageImage

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Renpy custom Positions changing randomly

#2 Post by _ticlock_ »

minyan wrote: Fri Nov 11, 2022 4:43 am
How the sprite is defined? Just to make sure it is not coming from the sprite itself.

span4ev
Regular
Posts: 105
Joined: Fri Jul 08, 2022 9:29 pm
itch: rpymc
Contact:

Re: Renpy custom Positions changing randomly

#3 Post by span4ev »

minyan wrote: Fri Nov 11, 2022 4:43 am Each time I show the sprite, he'll be in a different location on the screen, even though it's the same position. I tried to do it with a transform:
Have you tried creating another project and testing the alignment in it?
Are you sure there are no more variables named "cen" in your code?
Can the size of the sprite change?
Have you tried defining not using define but using $ ?
Have you tried using a different alignment method?

Code: Select all

init:
    $ x = 0.5
    $ y = 200
	$ cen = Transform(xalign=x, ypos=y)

What do you mean by different location? Is the offset in x or y or in x and y at once?

User avatar
minyan
Miko-Class Veteran
Posts: 630
Joined: Tue Feb 10, 2015 3:59 pm
Completed: Trial By Fire, Heartbaked, Ellaria, Plain, This My Soul, The Pretenders Guild
Projects: Arena Circus
Tumblr: minyanstudios
itch: harlevin
Contact:

Re: Renpy custom Positions changing randomly

#4 Post by minyan »

I figured it out, it was coming from my layered sprite! There was one image in the layers that was a larger size and it was causing the sprite to move when it was used.

Thanks for the assistance!
ImageImage

Post Reply

Who is online

Users browsing this forum: No registered users