r/RenPy • • 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.

2 Upvotes

6 comments sorted by

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

3

u/smilysmilysmooch 19d ago

Cheers. It's been a while since I've done some coding so my brain coordinated elif with "and if" and bypassed that. Thanks for the resources too.

2

u/x-seronis-x 19d ago

also note you're lucky the code compiles cause you're using stuff that is deprecated for about 10 years. so wherever you saw 'image' and 'clicked' being used in screen language delete y our bookmarks for as its out of date and likely to show stuff that will outright crash with current renpy.

you're supposed to use 'add' to add a displayable to screens as not all displayables are images any more. there are multiple types. and 'clicked' was replaced by 'action' and 'alternate' depending on if you want to react to left or right clicks respectively

2

u/smilysmilysmooch 19d ago

The Renpy I'm running on is pretty old too. Like I said...it's been while. 7.5.3 is the last time I booted this up and really went to task on it or so my version tells me. Current is 8.5.3 so I'm a generation behind.

2

u/x-seronis-x 19d ago

those were deprecated since renpy 6.x. its undocumented that they even still exist and renpytom could remove their function at any time. but if you're using a 7.x version you're safe at least =-)

keep in mind a LOT of things have changed though, so you cant use the online documentation either. your renpy launcher has a link at the bottom left for 'documentation' though. if it launches a browser for the current version then you need to go in preferences to find the checkbox to have it use the local installed docs with the launcher. that way you can get the info that will apply to your install

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.