[SOLVED] Different textboxes for characters not aligning

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
MonsoonMushroom
Regular
Posts: 62
Joined: Thu Jan 21, 2016 2:19 pm
Projects: Fate of the Squire
Organization: MonsoonMushroom
Contact:

[SOLVED] Different textboxes for characters not aligning

#1 Post by MonsoonMushroom »

Hello, I'm back again with a problem that's probably really easy to fix if you're not hopeless at coding.

I want each of my characters to have a different background to their side image and figured the best way to do it (because my side images are scaled down versions of full sprites, not their own separate image) would be to change the textbox for each character. I've chosen the background for the main character as the default, and it works fine:

Image

However, when I tried specifying another character should have a different textbox with this code...

Code: Select all

init:
    image arelisprite = DynamicDisplayable(draw_areli)
    define Ar = Character ("Areli", window_background="gui/textbox_areli.png", image = "areli",) # <-- important bit
    image areli = "arelisprite"
    image side areli = LiveCrop((0,0,286,393),"arelisprite")
It resulted in this:

Image

As far as I know, it's supposed to take the dimensions of the default textbox without needing anything extra. Even so, I've tried manually adding xpos/ypos and xalign/yalign to move, and the textbox stays exactly where it is. How do I make it sit exactly where the default textbox is? I think (well, I hope) this has an easy fix, so any help would really be appreciated!
Last edited by MonsoonMushroom on Fri Aug 11, 2017 1:32 pm, edited 1 time in total.

User avatar
Pyr0
Newbie
Posts: 20
Joined: Mon Aug 07, 2017 4:34 pm
Contact:

Re: Different textboxes for characters

#2 Post by Pyr0 »

Are you sure the two images are the same size? You may have left some blankspace on top of the other one.

MonsoonMushroom
Regular
Posts: 62
Joined: Thu Jan 21, 2016 2:19 pm
Projects: Fate of the Squire
Organization: MonsoonMushroom
Contact:

Re: Different textboxes for characters

#3 Post by MonsoonMushroom »

Pyr0 wrote: Thu Aug 10, 2017 7:22 am Are you sure the two images are the same size? You may have left some blankspace on top of the other one.
Doubled checked - they're definitely the same size. I even told it to use the same image as the one I use as a default, and it also showed up at the bottom of the screen. I'm not really sure what I'm doing wrong :(

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Different textboxes for characters

#4 Post by Kinmoku »

I'm not the best coder either, but the way I've done this in the past is to remove the default window_background, then assign a window_background on a per character basis.

Here's one I've done before:

Code: Select all

define r = Character(None, what_xpos=380, what_ypos=140, what_xalign=0.5, what_yalign=0.5, window_xpos=390, window_ypos=138, window_xmaximum=720, window_xfill=True, what_text_align=0.5, window_background="rbox", callback=rcallback, all_at_once=False)
You can see I strayed quite far from the default, but it worked :)

MonsoonMushroom
Regular
Posts: 62
Joined: Thu Jan 21, 2016 2:19 pm
Projects: Fate of the Squire
Organization: MonsoonMushroom
Contact:

Re: Different textboxes for characters

#5 Post by MonsoonMushroom »

I messed around with some things and... seem to have fixed it? I changed some values in my screens.rpy say code, which looks like now:

Code: Select all

style window:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height

    background Image ("gui/textbox_le.png", xalign=0, yalign=0)
and my gui window (I think this is the only relevant part of it anyway):

Code: Select all

## The height of the textbox containing dialogue.
define gui.textbox_height = 150

## The placement of the textbox vertically on the screen. 0.0 is the top, 0.5 is
## center, and 1.0 is the bottom.
define gui.textbox_yalign = 0.75
I've messed around with the default gui a fair bit since making the game, so maybe I'd accidentally screwed something up and now I've accidentally screwed it back into place again. In any case, it works fine now!

Post Reply

Who is online

Users browsing this forum: Google [Bot]