[solved] Need help in coding speech bubble textbox

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
propanoll
Regular
Posts: 55
Joined: Fri Dec 21, 2012 8:58 am
Projects: Left of Center, Night at the Hospital, The Buried Moon, RA: Allegiance
Tumblr: propanoll
Deviantart: shotafied
Contact:

[solved] Need help in coding speech bubble textbox

#1 Post by propanoll »

Hi! Is it possible to achieve this kind of textbox style in Ren'py?

Image

The textbox is speech bubble-like and whenever the next person says something, the speech bubble overlaps the previous one (Or the previous one retracts. This one works better, I think). Naturally, the textbox should also correspond to the positioned characters, but I have no idea how to do it or figure out the logic behind livecomposite lllorz . Please help?;;
Last edited by propanoll on Tue Mar 12, 2013 9:58 am, edited 1 time in total.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Need help in coding speech bubble textbox

#2 Post by xela »

Yes, it is possible. You need to create a separate text window for each character and assign that window to them. That will ensure desired behavior and you can position those windows according to characters positions.

If you're planning to move characters around, you'll have to get creative... like a function that positions the window depending on character's image or something like that.
Like what we're doing? Support us at:
Image

User avatar
propanoll
Regular
Posts: 55
Joined: Fri Dec 21, 2012 8:58 am
Projects: Left of Center, Night at the Hospital, The Buried Moon, RA: Allegiance
Tumblr: propanoll
Deviantart: shotafied
Contact:

Re: Need help in coding speech bubble textbox

#3 Post by propanoll »

I don't really want to assign the windows according to the characters, but rather, the position. Do they work the same way?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Need help in coding speech bubble textbox

#4 Post by xela »

propanoll wrote:I don't really want to assign the windows according to the characters, but rather, the position. Do they work the same way?
I do not understand... You can obviously position any window you create or the default one that comes with RenPy as you like BUT in order to adjust position of that window to a position of an image as it appears on the screen, would require some coding (or at least I know of no simple way to achieve that).

Maybe someone else who has experience with this type of design or knows RenPy better could be of assistance...
Like what we're doing? Support us at:
Image

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: Need help in coding speech bubble textbox

#5 Post by OokamiKasumi »

propanoll wrote: The textbox is speech bubble-like and whenever the next person says something, the speech bubble overlaps the previous one (Or the previous one retracts. This one works better, I think). Naturally, the textbox should also correspond to the positioned characters, but I have no idea how to do it or figure out the logic behind livecomposite lllorz . Please help?;;
Textboxes appear and disappear according to the character assigned to that text-box.
-- And that's the main problem you're going to have to deal with: Text-boxes are Assigned. That's what makes them appear.

Yes, it's entirely possible to have different text-boxes for a character in any number of different positions. The trick is, you have to assign each text-box individually, and Call them individually. In other words, you're going to need to assign a new text-box for Each Position.

Example: Coded for a 600x800 Game.
-- In your script.rpy file, in the init section:

Code: Select all

    #A normal character using the default box.
    define a = Character('Arthur', 
        color="#6699cc",)
    
    # This is Arthur's Special textbox on the left. --------------------
    define a_lft = Character('Arthur',
        color="99ccff", 
        who_xpos = 20, 
        window_background = Frame("ui/TxtBox_proLft.png", 0, 0),
        window_yminimum = 200,
        
        window_left_margin = 0,
        window_right_margin = 100,
        window_top_margin = 6,
        window_bottom_margin = 0,
        
        window_left_padding = 50,
        window_right_padding = 50,
        window_top_padding = 13,
        window_bottom_padding = 10,

        ctc="ctc_blink",)

    #This is Arthur's Special textbox on the right. -----------------
    define a_rt= Character('Arthur',
        color="99ccff", 
        who_xpos = 475, 
        window_background = Frame("ui/TxtBox_proRt.png", 0, 0),
        window_yminimum = 200,
        
        window_left_margin = 100,
        window_right_margin = 0,
        window_top_margin = 6,
        window_bottom_margin = 0,
        
        window_left_padding = 75,
        window_right_padding = 50,
        window_top_padding = 13,
        window_bottom_padding = 10,

        ctc="ctc_blink",)

You call these individual boxes this way:

Code: Select all

label start:
    scene bg00 with fade

    show art at basicfade, left 
    a_lft "You've created a new Ren'Py game."

    show art at right with move
    a_rt "Once you add a story, pictures, and music, you can release it to the world!"
    
    hide art at basicfade
And it looks like this.
ProTextBx1.jpg
ProTextBx2.jpg
Last edited by OokamiKasumi on Wed Mar 06, 2013 9:09 pm, edited 1 time in total.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Need help in coding speech bubble textbox

#6 Post by xela »

Well, that was a damn good explanation :)
Like what we're doing? Support us at:
Image

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: Need help in coding speech bubble textbox

#7 Post by OokamiKasumi »

xela wrote:Well, that was a damn good explanation :)
LOL! Thanks.
-- I firmly believe in giving thorough instructions. It saves on time, and extra posts asking for clarification.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
propanoll
Regular
Posts: 55
Joined: Fri Dec 21, 2012 8:58 am
Projects: Left of Center, Night at the Hospital, The Buried Moon, RA: Allegiance
Tumblr: propanoll
Deviantart: shotafied
Contact:

Re: [solved] Need help in coding speech bubble textbox

#8 Post by propanoll »

Oooh, thank you so much! You're my life-saver ;v;

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: [solved] Need help in coding speech bubble textbox

#9 Post by OokamiKasumi »

propanoll wrote:Oooh, thank you so much! You're my life-saver ;v;
Glad I could help.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

Post Reply

Who is online

Users browsing this forum: Google [Bot]