layeredimage with conditions inside

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
KingsCard
Newbie
Posts: 14
Joined: Sat Feb 17, 2018 8:58 am
Contact:

layeredimage with conditions inside

#1 Post by KingsCard »

Hi,

I’m a little lost with the new layeredimage function. I tried to follow the tutorials but I can’t obtain what I need :

- Every images are complete (outfit, emotion, pose)
- girl_green_happy.png
- girl_green_unhappy.png
- girl_pink_happy.png
- girl_pink_unhappy.png

- The outfit has to be a variable ($ outfit = "pink")
The player must be able to choose the outfit during the game, so I can't hard code it
- The emotion is set in the show statement (show girl unhappy)
Every emotion will have an effect like arms, body or head moving

I tried a large number of combinations with variant, prefix, auto, ... and the if statement in the layeredimage function doesn’t let me do anything.

I'm sure the answer is right in front of me ... Does someone has a tip ?

Thank you :).

KingsCard
Newbie
Posts: 14
Joined: Sat Feb 17, 2018 8:58 am
Contact:

Re: layeredimage with conditions inside

#2 Post by KingsCard »

Hi,

It may not be a layeredimage solution ... I ould be happy anyway :p !

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: layeredimage with conditions inside

#3 Post by trooper6 »

So, layered images are good for when you are layering images on top of each other. For example, I have a sprite whose base is a man in a shirt, pants, and vest. But he has no eyes, mouth, or eyebrows. I use a layeredimage because I want to be able to layer on different eyes, mouths, eyebrows onto the sprite. I also want to sometimes layer on a jacket or hat. So for this? I need a layered image.

You are not layering different images into one sprite, so you don't need a layered image. What you can use, however, is a dynamic image.

So you could do:

Code: Select all

default outfit = "green"

image girl happy = "images/girl_[outfit]_happy.png"
image girl unhappy = "images/girl_[outfit]_unhappy.png"

label start:
    show girl happy at left
    "See the happy green girl"
    show girl unhappy
    "See the unhappy green girl"

    $outfit = "pink"
    show girl happy at left
    "See the happy pink girl"
    show girl unhappy
    "See the unhappy pink girl"

    return
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

KingsCard
Newbie
Posts: 14
Joined: Sat Feb 17, 2018 8:58 am
Contact:

Re: layeredimage with conditions inside

#4 Post by KingsCard »

Trooper, you're the man and I thank you ! :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]