so i was following
this excellent tutorial on how to use layeredimages in ren'py and working on my
first real sprite for Iron Company.
all was well,
up to a point: most of Erika's eyes go under her hair. she has some silly expressions where her eyes go on top of her hair, though. so i needed to have two groups of eyes: one below the layer the lines of the hair are drawn on, and one above it.
basically the way i had the erika sprite groups structured was like this:
1. base
2. mouth
3. eyes
4. hair lines
5. eyes2
since there's no way two groups within a layeredimage could have the same name, ren'py would yell at me, this is foreshadowing btw6. extras (little anime sweatdrops, sparkles, etc.)
7. hands
ren'py assembles the layers of a layeredimage in that order. like, you know, layers in a digital art program. or animation cels with different layers. or a lasagna. same concept.
eyes and eyes2 were SUPPOSED to be mutually exclusive.
except.
as i started to add expressions to her lines in chapter 1, things started to go very wrong.
above you can see she's displaying 2 sets of eyes at the same time and it's, not, good.
this was happening whenever her expression switched from one set of eyes to the other.
i was trying to use if_any the way the tutorial linked above presents them. some of the relevant passage:
at the top of the layeredimage statement, i had things set up like this...
(you may notice the if_not section from the tutorial is missing here, that's bc at this point i had removed it to see if maybe it was superfluous or screwing things up)it seemed like it should have been so simple. this is some basic if-then shit! it's
simply boolean! if any of the eyes group are showing, the eyes2 group should
default to erika_e2_blank.png (a single-pixel transparent image), and vice-versa. right?
RIGHT? THAT'S WHAT IT LOOKS LIKE IT SHOULD BE DOING? RIGHT?
it was not working. i went through almost every stage of grief, although i did furiously avoid Acceptance (going to the ren'py subreddit, or to bed). what you don't see here is how many times i re-structured my filenames (filenames are important to layeredimages too), checked to make sure the blank.pngs were actually blank, picked up my rubber duck and read the code to him. even a hot shower didn't solve the problem. i'm proud of my investigative work even though ultimately i didn't figure it out on my own; i sandboxed this fucker, i tested things a less experienced me never would have thought to test (
is it a problem with LayeredImageProxy? is it my file structure? my naming scheme? does it matter if there's an if_not block or not? etc.). this is your reminder that i am still in my infancy as a coder, and i am maybe
at best 80-75% certain of what i am doing at any given time. i've sharpened up a lot this year, but i'm still a novice.
but i was getting toward 90% certain that the computer was wrong for real this time, and i was starting to get a little tilted

i was telling my very cool and smart friend
Kayin about this and they asked to see the code, thinking maybe they could spot something. i sandboxed the problem for them in a new ren'py project, sent it over, and, as usual, could not stop trying to solve it myself. my stubbornness is a trait that is both helpful and destructive and often both at the same time. i made no progress, though. i just kept staring at the problem and coming up with the same solution every time. like this is the point i was at; i had been extremely thorough trying to get this to work and my brain was going "but thing should simply work as intended, shouldn't it?" and providing the same solution
here is what Kayin ultimately discovered, about 40-ish minutes after i sent them the sandbox game, and after i had finally dragged myself away to bed, trying to accept that perhaps the problem would be solved in the morning. you might wanna sit down for this,
you can just have two groups in a layeredimage that are named the same thing.
pictured: my reaction to learning this. please note the timestamp
i had not once considered this. i'm used to Ren'py yelling at me if there are any situations where there are Two Of The Same Thing In A Thing. very often, i run the game and Ren'py whacks me over the head with a rolled-up newspaper and tells me "you can't have two instances of this, DINGUS" and i'm like "lmfao oops sorry". you can't just have multiple instances of a thing
within the same thing! that's not how
things work! except when it is. the entire if_any excursion was a total distraction. a farce.
a fool's errand. i was looking for clothes. but i was at the soup store.
the final code, if you're curious, looks like
this. (pastebin link)
Lessons learned:
• only trust your fists.
the police (documentation) will never help you
• always ask yourself: am i solving the correct problem? am i sure the code i'm staring at is meant to solve the problem i'm trying to solve?
am i perhaps trying to buy clothes at the soup store????• if you wish something worked a simpler way, try it the way you wish it worked and see if it does.
• it's always the thing that never works otherwise. or it's never the thing that always works. basically if something looks like it really should work that's why it doesn't, and if something doesn't look like it should work, that's why it does,
• i am blessed to have lovely friendships with smart and kind people
• i knew this already, but it is a miracle that even the simplest video game exists
addendum: the final hilarious punch:
this was in the documentation. (under "groups.") i just didn't see it because it wasn't what i was looking for. i was all mired in the if_any bullshit. i rarely actually look at the documentation (i tend to search the subreddit or the forum or the discord) because it tends to be written in a way i just... can't process, especially when i'm already frustrated and confused lmao. and it never has the specific kind of example i need, because i am forever Problems Georg. so i missed it. but it was there. what an incredible comedy of errors