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.
-
Ryue
- Miko-Class Veteran
- Posts: 745
- Joined: Fri Nov 02, 2012 8:41 am
- Projects: Red eyes in the darkness
-
Contact:
#1
Post
by Ryue » Thu Jul 21, 2016 3:58 pm
I'm trying to be .... imaginative and have a background image upon which another image is displayed. I used a frame and subframe for this.
Now what I wanted is the second image to be centered inside the frame image, but somehow it is still displayed to the right (even if I use xysize 1366,200 in the
subframe).
What am I doing wrong there?
Example image (b/w image is the one I wanted centered):
Code: Select all
screen DescriptionMap(imageName):
frame:
xysize 1366,200
top_margin 22
left_margin 200
background "Graphics/GUI/mapbox.png"
frame:
xalign 0.5
yalign 0.5
background imageName
-
chocoberrie
- Veteran
- Posts: 254
- Joined: Wed Jun 19, 2013 10:34 pm
- Projects: Marshmallow Days
-
Contact:
#2
Post
by chocoberrie » Thu Jul 21, 2016 8:41 pm
Try changing the value you have for left_margin from 200 to something greater. Margins are how far away from the left or right side the image is, so in your code, left_margin = 200 means that the image is 200 pixels away from the left side of the frame.

-
Ryue
- Miko-Class Veteran
- Posts: 745
- Joined: Fri Nov 02, 2012 8:41 am
- Projects: Red eyes in the darkness
-
Contact:
#3
Post
by Ryue » Fri Jul 22, 2016 1:25 am
chocoberrie wrote:Try changing the value you have for left_margin from 200 to something greater. Margins are how far away from the left or right side the image is, so in your code, left_margin = 200 means that the image is 200 pixels away from the left side of the frame.

although that margin should only count for the mainframe and thus for positioning it and thus not affect the subframe within the mainframe or am I wrong there?
(I need the main frame at exactly that position where it is now)
-
Ryue
- Miko-Class Veteran
- Posts: 745
- Joined: Fri Nov 02, 2012 8:41 am
- Projects: Red eyes in the darkness
-
Contact:
#4
Post
by Ryue » Sat Jul 23, 2016 12:55 am
As an update here even not using a second frame somehow does not bring a solution there:
Code: Select all
screen DescriptionMap(imageName):
frame:
xysize 973,209
top_margin 22
left_margin 200
background "Graphics/GUI/mapbox.png"
image imageName xalign 0.5 yalign 0.5
The image is a bit more to the right now but still far from being centered inside the frame. I have to add xanchor 0.37 to the image itself which I find.....strange.
Any clues there?
-
xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
-
Contact:
#5
Post
by xavimat » Sat Jul 23, 2016 12:04 pm
margins do not position the frame but the elements inside it. Your main frame has a left margin of 200 and a right margin of 0 (I presume, is not defined). Thus, the xcenter of the frame is 100 pixels to the right.
Add xoffset -100 to the subframe to center it.
-
Ryue
- Miko-Class Veteran
- Posts: 745
- Joined: Fri Nov 02, 2012 8:41 am
- Projects: Red eyes in the darkness
-
Contact:
#6
Post
by Ryue » Sat Jul 23, 2016 12:13 pm
xavimat wrote:margins do not position the frame but the elements inside it. Your main frame has a left margin of 200 and a right margin of 0 (I presume, is not defined). Thus, the xcenter of the frame is 100 pixels to the right.
Add xoffset -100 to the subframe to center it.
that means then I would also need to put left_margin 200 into the subframe?
-
xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
-
Contact:
#7
Post
by xavimat » Sun Jul 24, 2016 9:49 am
Why?
-
Ryue
- Miko-Class Veteran
- Posts: 745
- Joined: Fri Nov 02, 2012 8:41 am
- Projects: Red eyes in the darkness
-
Contact:
#8
Post
by Ryue » Sun Jul 24, 2016 10:27 am
xavimat wrote:Why?
I asked as I'm not 100% getting what you meant
-
xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
-
Contact:
#9
Post
by xavimat » Tue Jul 26, 2016 5:51 am
I don't fully understand what do you need.
In your example you use a subframe with a background only to put an image in the center of the main frame. I suggest you to use "add" to put an image (and position it) in the main frame and forget the subframe.
I also suggest to forget all the margins. They do not serve to position the frame (as I presume you think from your explanation) and I think they are confusing you.
If you need a space between the left limit of the screen and the frame, use xpos 200.