Customizable Sprites that are Separate [SOLVED]

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
ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

Customizable Sprites that are Separate [SOLVED]

#1 Post by ArizaLuca »

I wish to have two sprites in my game. One will move/blink/otherwise emote, and the other will not, but they both look the exact same based on how the unmoving one is customized. Is that possible to code?

(The sprites both have six hair colors, six eye colors, and four skin tones to choose from.)

Thank you.

EDIT: I actually figured out a solution. What I did was I coded in the customization like this:

Code: Select all

default hair = 1
default skin = 1
default eye = 1

label start:
    
    "Yo, we're gonna try this out."
    
    jump haircolor
    
label haircolor:
    
    "What color hair does your character have?"
    
    menu:
        
        "Blonde.":
            pass
            jump skincolor
        
        "Red.":
            $ hair += 1
            jump skincolor
        
        "Light brown.":
            $ hair += 2
            jump skincolor
        
        "Brown.":
            $ hair += 3
            jump skincolor
        
        "Dark brown.":
            $ hair += 4
            jump skincolor
        
        "Black.":
            $ hair += 5
            jump skincolor
    
label skincolor:
    
    "What color skin does your character have?"
    
    menu:
        
        "Light.":
            pass
            jump eyecolor
        
        "Asian.":
            $ skin += 1
            jump eyecolor
        
        "Tan.":
            $ skin += 2
            jump eyecolor
        
        "Dark.":
            $ skin += 3
            jump eyecolor
    
label eyecolor: 
    
    "What color eyes does your character have?"
    
    menu:
        
        "Blue.":
            pass
            jump done
        
        "Black.":
            $ eye += 1
            jump done
        
        "Brown.":
            $ eye += 2
            jump done
        
        "Gray.":
            $ eye += 3
            jump done
        
        "Green.":
            $ eye += 4
            jump done
        
        "Gold.":
            $ eye += 5
            jump done
        
label done:
    
    show doll
And then coded the two images like this:

Code: Select all

############# DOLL ############# The one that doesn't move.

layeredimage doll:
    always:
        "doll_base"
    if skin == 1:
        "doll_skin_light"
    elif skin == 2:
        "doll_skin_asian"
    elif skin == 3:
        "doll_skin_tan"
    elif skin == 4:
        "doll_skin_dark"
    group outfit:
        attribute outfit default:
            "doll_outfit_normal"
    if hair == 1:
        "doll_hair_blonde"
    elif hair == 2:
        "doll_hair_red"
    elif hair == 3:
        "doll_hair_lightbrown"
    elif hair == 4:
        "doll_hair_brown"
    elif hair == 5:
        "doll_hair_darkbrown"
    elif hair == 6:
        "doll_hair_black"
    group eyebrows auto:
        attribute normal default
    group mouth auto:
        attribute normal default
    if eye == 1:
        "doll_eyes_blue_normal"
    elif eye == 2:
        "doll_eyes_black_normal"
    elif eye == 3:
        "doll_eyes_brown_normal"
    elif eye == 4:
        "doll_eyes_gray_normal"
    elif eye == 5:
        "doll_eyes_green_normal"
    elif eye == 6:
        "doll_eyes_gold_normal"

############# PLAYER ############## The one that moves.
    
layeredimage player:
    always:
        "doll_base"
    if skin == 1:
        "doll_skin_light"
    elif skin == 2:
        "doll_skin_asian"
    elif skin == 3:
        "doll_skin_tan"
    elif skin == 4:
        "doll_skin_dark"
    group outfit:
        attribute outfit default:
            "doll_outfit_normal"
    if hair == 1:
        "doll_hair_blonde"
    elif hair == 2:
        "doll_hair_red"
    elif hair == 3:
        "doll_hair_lightbrown"
    elif hair == 4:
        "doll_hair_brown"
    elif hair == 5:
        "doll_hair_darkbrown"
    elif hair == 6:
        "doll_hair_black"
    group eyebrows auto:
        attribute normal default:
            "doll_eyebrows_normal"
        attribute raised:
            "doll_eyebrows_raised"
        attribute angry:
            "doll_eyebrows_angry"
        attribute flat:
            "doll_eyebrows_flat"
        attribute sad:
            "doll_eyebrows_sad"
        attribute quirked:
            "doll_eyebrows_quirked"
    group mouth auto:
        attribute normal default:
            "doll_mouth_normal"
        attribute open:
            "doll_mouth_open"
        attribute opensmile:
            "doll_mouth_opensmile"
        attribute smile:
            "doll_mouth_smile"
        attribute frown:
            "doll_mouth_frown"
        attribute shout:
            "doll_mouth_shout"
        attribute teeth:
            "doll_mouth_teeth"
        attribute thoughtful:
            "doll_mouth_thoughtful"
        
    if eye == 1:
        "blue eyes"
    elif eye == 2:
        "black eyes" 
    elif eye == 3:
        "brown eyes"
    elif eye == 4:
        "gray eyes"
    elif eye == 5:
        "green eyes"
    elif eye == 6:
        "gold eyes"

Post Reply

Who is online

Users browsing this forum: No registered users