Permanent sprite change

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
kurogane
Newbie
Posts: 2
Joined: Wed Aug 08, 2018 9:57 pm
Contact:

Permanent sprite change

#1 Post by kurogane »

This is my first foray into ren'py and as I'm plotting out the story I hit a problem. At one point, one of the characters can choose to transform into one of a few forms. My problem is this: is it possible to do this in a way where after the choice I can just call the character and it calls the sprites for the right form automatically? I'm guessing I'll need to use a switch of some sort? Sorry if this sounds confusing, I'm not the best at explaining things. Thank you in advance for any help you can give me.

User avatar
vollschauer
Veteran
Posts: 231
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Permanent sprite change

#2 Post by vollschauer »


User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Permanent sprite change

#3 Post by Remix »

The easiest is just using DynamicImage with variable interpolation...

Code: Select all

default mc_form = "human"

image mc_sprite = "images/mc_[mc_form].png"
# initially will be 'images/mc_human.png'

label start:

    show mc_sprite
    "..."
    $ mc_form = "vampette"
    "..."
    $ mc_form = "werebabe"
    "..."
Lots easier than using switches if you get into the habit of naming images and variable values appropriately...
Frameworks & Scriptlets:

kurogane
Newbie
Posts: 2
Joined: Wed Aug 08, 2018 9:57 pm
Contact:

Re: Permanent sprite change

#4 Post by kurogane »

Would this work with expressions? Calling a happy/sad/angry version of the vampette for example.

User avatar
vollschauer
Veteran
Posts: 231
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Permanent sprite change

#5 Post by vollschauer »

I guess you are looking for this one: https://www.renpy.org/doc/html/layeredi ... red-images

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Galo223344, Google [Bot]