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 » Wed Aug 08, 2018 10:09 pm

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: 225
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Permanent sprite change

#2 Post by vollschauer » Thu Aug 09, 2018 2:01 am


User avatar
Remix
Miko-Class Veteran
Posts: 961
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I cannot draw very well)
Projects: An un-named 3d anime based trainer game
Contact:

Re: Permanent sprite change

#3 Post by Remix » Thu Aug 09, 2018 4:00 am

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...
Mad Scientist Todo List:
  • Finish Improved Event Handler
  • Implement DragonBones animation as a Creator Defined Container
  • Finish Catmull-Rom Spline pathing
  • Finish Bitmask collision and rebound vector system
  • Develop time based building mechanic
  • Others
  • *Find a superb artist and actually write a game*

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

Re: Permanent sprite change

#4 Post by kurogane » Thu Aug 09, 2018 8:32 am

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

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

Re: Permanent sprite change

#5 Post by vollschauer » Fri Aug 10, 2018 6:33 am

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: No registered users