Displaying Images according to a variable


So. I have this weird headcanon about Sans, like, if you ask him to do something he will find a excuse not too, but if Toriel does it, he will not have the heart to say no. I mean, that's basically canon, but the headcanon part is everybody else just found about that and are abusing the hell out it. And that headcanon it's the basis for a scene in User Interface, in which you have to choose Sans' clothes for a formal meeting. 

I don't know how to design clothes but I really believe that constrain of mine helped with the joke :D

The point was he was going to appear going forward with the choice of clothing, but, no matter how short the scene, I didn't want to every single time Sans needed a new expression to write a new if statement. 

So, what I did. 

First I wrote the images as separate image objects

image sansImg suit blue stiff = "sans/blueSuit/stiff.png"

image sansImg suit red stiff = "sans/redSuit/stiff.png"

image sansImg suit green stiff = "sans/greenSuit/stiff.png"

Then I put the if statement in a function call. Like this:

label sansSuitStiff:
if suit == 1:
show sansImg suit red stiff
elif suit == 2:
show sansImg suit blue stiff
else:
show sansImg suit green stiff
return

So when I need this expression, I just have to set the variable and call the function, like this:

call sansSuitStiff

The only problem with this was the fact I could not position him in the scene, neither to tell the object to use an at or with statement. So, I did this:

image sansImg position = im.Alpha("undyne/gym/mildsurprise.png", 0)

Yes, it is an Undyne related image, but the Alpha is 0, meaning it's transparent :D.  So, I can do something like this

show sansImg position at right with dissolve:
xpos 0.4
call sansSuitStiff

And thanks to the magic of Renpy the images would stay in its place. 

And I was pretty satisfied with my solution, until I poked around Renpy's Docs and found this: The Choice Statement

Meaning I could have done this instead:

image sansImg suit stiff:
choice (suit == 1):
"sansImg suit blue stiff"
choice (suit == 2):
"sansImg suit red stiff"
choice (suit == 3):
"sansImg suit green stiff"

show sansImg suit stiff at right with dissolve:
xpos 0.4

I then I cried in a corner. 

Oh well....

Edit (06/15/2020):

I tried to use the Choice Statement, it didn't work. Someone tell me what I'm doing wrong 

Get User Interface

Leave a comment

Log in with itch.io to leave a comment.