Side image position for different characters

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
kingsman88
Newbie
Posts: 4
Joined: Thu Aug 12, 2021 4:49 pm
Contact:

Side image position for different characters

#1 Post by kingsman88 »

Beginner question here. How do i assign a different side image position for two characters.

The side image for character x is by default at the bottom left

But i have a second character y and i need their side image to be at the opposite side on the right.

When i go into screens.rpy theres only one line of code for all side image positions:

## If there's a side image, display it above the text. Do not display on the
## phone variant - there's no room.
if not renpy.variant("small"):
add SideImage() xalign 0.0 yalign 1.0
--

Thank you

I went through dozens of youtube tutorials and reddit posts on side images but none of them discuss this issue

jeffster
Miko-Class Veteran
Posts: 516
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Side image position for different characters

#2 Post by jeffster »

There are several ways to customize the appearance of different characters.

We can assign different styles or even a different screen for a speaking character:

https://www.renpy.org/doc/html/dialogue.html#Character

(E.g. we can copy the "say" screen and modify it however we like, adding different textbox pictures, colors and so on. Devil would speak in demonic setting, Angel in angelic.)

For simpler tasks, we can define specific styles. (window_style etc.)

Inspect the side image you have to see which styles affect it: when that character dialogue is on screen, point at the side picture and press shift-i.

Most likely, you would see something like "default" and "image" - i.e. window style doesn't affect it directly. Then we would need to modify the screen, not just styles. (See "screen" by the link above.)

Code: Select all

# Add a custom parameter to the character:
define p = Character("Player", image="player", show_side_right=True)

# It has some side image like this:
image side player = "side_player.png"

# In the screens.rpy,
# add a new parameter to the say screen:

screen say(who, what, side_right = False):

#...
# In the side image part, add a condition:

    if not renpy.variant("small"):
        if side_right:
            add SideImage() xalign 1.0 yalign 1.0
        else:
            add SideImage() xalign 0.0 yalign 1.0
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)

kingsman88
Newbie
Posts: 4
Joined: Thu Aug 12, 2021 4:49 pm
Contact:

Re: Side image position for different characters

#3 Post by kingsman88 »

Thank You!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]