[SOLVED]How to put image inside another image without messing up the screen position?

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
Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

[SOLVED]How to put image inside another image without messing up the screen position?

#1 Post by Nero »

How can I have 2 images inside same vbox without them interacting with each other. I know I could make another vbox but that would be time consuming to adjust x and y of another image to match the x,y of my main image.

For example here I have code that shows party members on screen. Every member have its own image that is 120x120 . When member gets debuffed small icon should apper over the existing image that is 35x35 WITHOUT messing up the x,y location of my [team_front_line] members. What I need to do in order to disable x,y interaction between those 2 images?

Here is my current code:

Code: Select all

screen battle_stats():
    vbox:
        xalign 0.250
        yalign 0.400
        spacing 80
        for player in team_front_line: # Always show players pictures on screen
            if player.hp > 1:
                add player.picture

        for skill in skill_active: # If player is debuffed show small debuff icon on him
            if skill.cooldown >= 1:
                for player in team_front_line:
                    if player.debuffed:
                        add skill1.picture
Last edited by Nero on Tue Dec 11, 2018 2:33 pm, edited 1 time in total.

rames44
Veteran
Posts: 233
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: How to put image inside another image without messing up the screen position?

#2 Post by rames44 »

Perhaps the best thing to do is to nest a Fixed inside your vbox for each character, and then put your character image and 35x35 inside that. This way, the presence or absence of the 35x35 won’t affect the vbox layout, since all it will see is the fixeds.

Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: How to put image inside another image without messing up the screen position?

#3 Post by Nero »

Ok tried this method it works also. There is other method I thought of not so proud of it but it work. I gave to if player.debuffed else: and added blank image and set its xpos off screen xpos -2000 like so. But using fixed is much more better way of doing it. Thanks.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]