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
User Interface
An Undertale Fan Visual Novel about trying really hard. And failure.
Status | Released |
Author | Ginny Neutron |
Genre | Interactive Fiction, Visual Novel |
Tags | Fangame |
Languages | English |
More posts
- User Interface v0.4.3Dec 13, 2020
- How to mark a button as already selected in RenpySep 20, 2020
- User Interface Vr 0.4.0Jul 17, 2020
- I'm not dead, just depressedJun 25, 2020
- User Interface Chapter 3, with Graphics!Dec 08, 2019
- How to put voice to Characters in Renpy (Character Callback)Nov 12, 2019
- My computer fried (Edit: Not anymore)Oct 22, 2019
- User Interface Chapter 3 (Text Only)Oct 07, 2019
- The Persistent Object on RenpySep 30, 2019
- How to jump to the title screen in RenpyJul 31, 2019
Leave a comment
Log in with itch.io to leave a comment.