how to set an absolute margin

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
bozance
Regular
Posts: 61
Joined: Thu Feb 12, 2009 12:19 am
Contact:

how to set an absolute margin

#1 Post by bozance »

Here is another puzzle--at least, it is a puzzle to me.

I have stats at the bottom of my screen. They tend to change position a bit when data changes.

How can I simply set an absolute value--a margin, so that "xp" is indented just a bit from the right edge of the screen and actually stays at that indentation as its numbers get bigger? (It is the last item listed and you can probably tell I can't quite figure out xalign, xpos, etc).

Any wisdom would be greatly appreciated.

screen statsfull:
hbox:
yalign 0.99
xpos 0.01
xfill True
text("{color=#5f9ea0}Fear: %d" % fear, "/%d{/color}" % fearmax)
text("{color=#5f9ea0}Stam: +%d{/color}" % stam)
text("{color=#5f9ea0}Per: +%d{/color}" % per)
text("{color=#5f9ea0}Att: %s{/color}" % att)
text("{color=#5f9ea0}HP: %s{/color}" % hp)
text("{color=#5f9ea0}Lvl: %d{/color}" % lvl) xpos 0.85
text("{color=#5f9ea0}XP: %d" % xp, "/%d{/color}" % xpmax) xalign .85

Octavise
Newbie
Posts: 15
Joined: Thu Oct 28, 2010 2:48 pm
Contact:

Re: how to set an absolute margin

#2 Post by Octavise »

Might have to use area(xpos, ypos, width, height) instead of yalign and xpos so that it updates and stays in the right spot.

You'll probably still want to have some code limiting just how long the "exp" amount can get tho. Outwise after playing the game long enough weird things might start happening

Post Reply

Who is online

Users browsing this forum: No registered users