Ren'Py Showing the head of character when talking

jeananonymous

Newbie
Mar 23, 2020
80
12
Hi,

i'm making my game using Renpy.

My question simple is there a way that every time i wrote a sentence for a specific character like this :

c "Hi, im a character"

the head defined for this character appears left on the textbox ?

thanks
 

MissFortune

I Was Once, Possibly, Maybe, Perhaps… A Harem King
Respected User
Game Developer
Aug 17, 2019
5,380
8,652
If you're referring to the image of a character or characters, then the above is correct. Elaine explains it pretty clearly in a tutorial.

 
  • Like
Reactions: 79flavors

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,258
Both have already given you the answer... so I'll throw in a very simple example:

Python:
define c = Character("Chris", image="chris")

image side chris = "side_chris.png"

label start:

    scene black with fade
    c "Hello, I'm [c]."

    return

The important thing is that the image = "id" and image side id = "filename" match.

So this is equally valid...

Python:
define c = Character("Chris", image="c_side")

image side c_side = "side_chris.png"

label start:

    scene black with fade
    c "Hello, I'm [c]."

    return

Then once, you start getting adventurous - you can start using side images with facial expressions too...

Python:
define c = Character("Chris", image="chris")

image side chris = "side_chris_neutral.png"
image side chris happy = "side_chris_happy.png"
image side chris sad = "side_chris_sad.png"
image side chris angry = "side_chris_angry.png"
image side chris oface = "side_chris_orgasm.png"

label start:

    scene black with fade
    c "Hello, I'm [c]."
    c happy "And now I'm showing a happy face."
    c oface "VERY, VERY happy!"
    c sad "And now I'm sad."

    return

The basics are that if you add a qualifier to the spoken text (what RenPy called a displayable tag), RenPy will try to match it to the closest side image. If you don't specify a mood or it can't find a match, it'll default to the side chris definition.

Most of the examples out there are focused on statements like show elaine happy. But that style is aimed at games that use character sprites. Adding the mood to the spoken dialogue is known as " " and is probably more common now that the majority of RenPy games use fully rendered scenes without overlaid character sprites.
 

jeananonymous

Newbie
Mar 23, 2020
80
12
pythonw_qzxF9sejH7.png
So here is the first test i've made, the character is 250x250pixel.
that's not bad but maybe a bit bigger would be nice. Do you know if there is specific size recommended ? (my game is in 1280x720)

thanks
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,975
16,230
Do you know if there is specific size recommended ?
Not too small but still small enough ?



There isn't real answer to your question, since it mostly depend of the rest of the User Interface (UI).
Globally speaking, your example is fine. At most it could be 15 pixels taller, but that's all since it shouldn't be taller than the text box, and ideally be centered with at least 10 pixels of padding to avoid a weird effect.