Page 1 of 1

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

Posted: Sat Dec 08, 2018 9:35 pm
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

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

Posted: Mon Dec 10, 2018 12:47 pm
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.

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

Posted: Tue Dec 11, 2018 2:33 pm
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.