Customizing blinking eyes (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
User avatar
Meg'
Regular
Posts: 175
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang
Location: France
Contact:

Customizing blinking eyes (SOLVED)

#1 Post by Meg' » Wed Jul 11, 2018 1:02 pm

I followed this tutorial to update the code I used for the heroine's customization in my game but I'm having trouble with applying the customization to the blinking for the eyes.

I tried those:

Code: Select all

    image blinking:

            "look_eyes_%s"
        
            choice:
                4.5
            choice:
                3.5
            choice:
                1.5

            "look_eyes_%s_half"
                
            "look_eyes_closed"
            .1
            "look_eyes_closed"
            .1
            repeat

Code: Select all

    image blinking:

        if eyes == 1:

            "look_eyes_1"

        if eyes == 2:

            "look_eyes_2"
            
        if eyes == 3:

            "look_eyes_3"
        
            choice:
                4.5
            choice:
                3.5
            choice:
                1.5

        if eyes == 1:

            "look_eyes_1_half"

        if eyes == 2:

            "look_eyes_2_half"
            
        if eyes == 3:

            "look_eyes_3_half"
                
            "look_eyes_closed"
            .1
            "look_eyes_closed"
            .1
            repeat
but they won't work. It seems I'm not on the right track.

How can I make it so that the blinking changes depending on the eyes color? Thanks in advance for your help ! :D
Last edited by Meg' on Thu Jul 12, 2018 3:25 am, edited 1 time in total.
Image

User avatar
Meg'
Regular
Posts: 175
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang
Location: France
Contact:

Re: Customizing blinking eyes

#2 Post by Meg' » Thu Jul 12, 2018 3:14 am

Ok, I seem to have solved this but there should be a quickest way to do it.

Here is the code I used:

in dressup.rpy

Code: Select all

init python:
    hair, eyes, skin, outfit = 1, 1, 1, 1,  # default dressup items
    hair_styles_num, eyes_styles_num, skin_styles_num, outfit_styles_num = 12, 3, 3, 10 # number of styles (files) for each dressup item
    
screen dressup_example():

    ## Ensure this appears on top of other screens.

    frame:

        xalign 0.9
        xsize 700
        yfill True
        
# YEUX / EYES

        hbox:

            xalign 0.5
            yalign 0.40
            spacing 400

            textbutton _("< YEUX") action SetVariable('eyes', max(eyes-1,1))
            textbutton _("YEUX >") action SetVariable('eyes',min(eyes+1,eyes_styles_num))

# PEAU / SKIN

        hbox:

            xalign 0.5
            yalign 0.60
            spacing 400


            textbutton _("< PEAU") action SetVariable('skin', max(skin-1,0))
            textbutton _("PEAU >") action SetVariable('skin',min(skin+1,skin_styles_num))

        add "look" xalign 0.5 
        
        add "images/look/look_exp_1.png" xalign 0.5
        
        if eyes == 1:
        
            add "blinking1" xalign 0.5
        
        if eyes == 2:
            
            add "blinking2" xalign 0.5
            
        if eyes == 3:
            
            add "blinking3" xalign 0.5
        

        
# TENUE / OUTFIT

        hbox:

            xalign 0.5
            yalign 0.90
            spacing 400

            textbutton _("< TENUE") action SetVariable('outfit', max(outfit-1,1))
            textbutton _("TENUE >") action SetVariable('outfit',min(outfit+1,outfit_styles_num))
            



# HAIRS / CHEVEUX

        hbox:

            xalign 0.5
            yalign 0.25
            spacing 400

            textbutton _("< CHEVEUX") action SetVariable('hair', max(hair-1,1))
            textbutton _("CHEVEUX >") action SetVariable('hair',min(hair+1,hair_styles_num))
            

        textbutton _("Done") action ToggleScreen("dressup_example") xalign 0.99 yalign 1.0
in definitions.rpy:

Code: Select all

    image blinking1:

            "look_eyes_1"
        
            choice:
                4.5
            choice:
                3.5
            choice:
                1.5

            "look_eyes_1_half"
            .1
                
            "look_eyes_closed"
            .1
            "look_eyes_closed"
            .1
            repeat
            
    image blinking2:

            "look_eyes_2"
        
            choice:
                4.5
            choice:
                3.5
            choice:
                1.5

            "look_eyes_2_half"
            .1
                
            "look_eyes_closed"
            .1
            "look_eyes_closed"
            .1
            repeat
            
    image blinking3:

            "look_eyes_3"
        
            choice:
                4.5
            choice:
                3.5
            choice:
                1.5

            "look_eyes_3_half"
            .1
                
            "look_eyes_closed"
            .1
            "look_eyes_closed"
            .1
            repeat
And for calling it in the script:

Code: Select all

    if eyes == 1:
        
        e side blinking1 look "Salut, je suis la nouvelle héroïne du jeu !"
        
    if eyes == 2:
        
        e side blinking2 look "Salut, je suis la nouvelle héroïne du jeu !"
        
    if eyes == 3:
        
        e side blinking3 look "Salut, je suis la nouvelle héroïne du jeu !"
Like I said, using this code each time is a loss of time and there should be a cleaner and faster way to implement that. Does anyone have a suggestion? Thank you in advance :D

EDIT:

I found a solution!

Code: Select all

        if eyes == 1:
        
            "blinking1"

        if eyes == 2:
            
            "blinking2"
            
        if eyes == 3:

            "blinking3"
I had to define the blinking and instead of saying, if eyes == 1 show me eyes1, I asked: if eyes == 1, show me "blinking1".
Image

Post Reply

Who is online

Users browsing this forum: Jackkel Dragon, Majestic-12 [Bot]