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.
Align is supposed to set both pos and anchor, so they should conflict with each other. I believe documentation never explained what should happen if you combine them together. That is probably why the changelog may not explicitly say it.
According to changelog 8.1 / 7.6:
Ren'Py will now produce errors when a screen sets two conflicting properties, like align, and xalign. Previously, the behavior of this was undefined.
It probably should not affect existing projects:
The new config.check_conflicting_properties variable, which is disabled in existing games but enabled in newly created games, enables you to check for conflicting style or transform properties being set concurrently.
Align and pos conflicting makes sense, there's never any reason to use them together either, but align and anchor are bread and butter. There are many scenarios that we need to align a specific corner of a displayable to somewhere, and that's impossible without using both of them. Should we report this as a but?
I believe the point is that you should be using pos and anchor instead of align and anchor, because align is setting anchor and pos together (e.g., xalign 1.0 sets xanchor to 1.0 and xpos to 1.0).
I see...
I've knew that pos can take floats, but I've always seen it as unnecessary complication.
Before, align would set the anchor if not provided otherwise, but now, it's like giving a spoon to kids to eat soup with, but forcing them to switch to knife and fork for those small chunks of potato in it, they fit in the spoon fine.
Kia wrote: ↑Mon Jun 26, 2023 2:18 am
I see...
I've knew that pos can take floats, but I've always seen it as unnecessary complication.
Before, align would set the anchor if not provided otherwise, but now, it's like giving a spoon to kids to eat soup with, but forcing them to switch to knife and fork for those small chunks of potato in it, they fit in the spoon fine.
I like the analogy, but I believe the confusion appeared because, previously, some of the renpy default screens used conflicting properties together.
We should either set pos and anchorpos (0.5,0.5) anchor (0.0, 0.0) or if they have the same value, we can use align (0.0,0.0). There are default values for pos and anchor if we don't specify any of these properties.
Conflicting properties may result in different behavior in some cases. For example https://github.com/renpy/renpy/issues/3702 (the example is about pos and align but the same is true for align and anchor)
In my opinion, keeping the pixel positioning for pos and percent positioning to align made much more sense, and makes for a code that's easier to read. But I should stop being a perfectionist, these small flaws are everywhere.
Thank you _ticlock_ ^^
pos, anchor and align all accemp both fractional or absolute values, and it is really useful sometimes.
(xanchor 0.0 xpos 0.5) and (xanchor 1.0 xpos 0.5) will position two images side-by-side at the center of the screen. Something like (anchor 12, 7) is useful for custom pointers, so you could position it exactly where you need.
While align works funny with absolute values (visually it image will remain in the top left corner), but they might be useful in conjunction with ATL animations.