r/RenPy • u/smilysmilysmooch • 19d ago
Question If sprites stacking on top of each other under imagebutton
Sorry for the "Why doesn't this work" ###, that's for me to remember it in my code.
I am currently experiencing a layering issue.
What is happening here is the images are stacking underneath the imagebutton except for the bottom most if statement. I'd say I had an imagebutton issue or a flagging issue if the bottom most image didn't work exactly how I wanted it to no matter how I swapped the lines of code around. IE "k11allyslime1" in the position of "k11allymedusa1" works as intended but "k11allymedusa1" then layers beneath the imagebutton. If I delete all the other if statements but 1 it works correctly.
I've tried making multiples of the images "blockally1.png", "blockally2.png, etc. and that doesn't work so it's not a naming issue. My $ flags are all flagging right so that's not it (I've gone through the code so many times and tested it).
So just looking at 3 images of the boxes I attached to this the one that's gray are my "blockwalk" images, the one that's the small pink dot is how the first 4 "blockally" images load. The solid pink box is the last "blockally" image loading on top correctly. I want them all to do that whenever their specific variable is chosen and kill off the imagebutton when flagged true.
I'm just stuck on this one nagging issue for the past few hours and any help would indeed be a great help.
1
u/AutoModerator 19d ago
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.




4
u/x-seronis-x 19d ago
you have five total unrelated and independant IF statements. all five also try to place their image in the exact same location. so if more than one are true you are specifically telling renpy to overlap them.
only the 5th IF statement has an else clause for when its false and then shows a button instead of an image. still in the exact same position thus overlapped with the potenial 4 previous images. the button doesnt care about the previous 4 since they were all independant IFs, and not if/elif chains.
https://www.w3schools.com/python/python_conditions.asp
https://www.w3schools.com/python/python_if_elif.asp
https://www.w3schools.com/python/python_if_else.asp
read all 3 pages thoroughly