Help with side image witch conditionswitch

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
yasminuscula
Newbie
Posts: 7
Joined: Tue May 24, 2022 9:15 pm
Contact:

Help with side image witch conditionswitch

#1 Post by yasminuscula » Thu Jun 30, 2022 10:18 pm

so in my game i made the option for the player to be able to choose a gender, like this:

Code: Select all

image mysprite = ConditionSwitch(
"gender=='masculino'", "boy_sprite.png",
"gender=='feminino'", "girl_sprite.png",
"gender== 'não binário/outro'", "nb_sprite.png")

Code: Select all

menu:
            "Eu me identifico com o gênero:"

            "Masculino":
                $ gender = "masculino"

            "Feminino":
                $ gender = "feminino"

            "Não binário/outro":

                $ gender = "não binário/outro"

        show mysprite
        "Você escolheu '[gender]'."


and it worked, but now I want to show that gender they chose as a side image, and I tried a bunch of different methods but for some reason the image still doesn't pop up, here's the code:

Code: Select all

define q = Character("[name]", color= "#00008B", image="mysprite")

image q = ConditionSwitch(
"gender=='masculino'", "boy_sprite.png",
"gender=='feminino'", "girl_sprite.png",
"gender== 'não binário/outro'", "nb_sprite.png")

image side q = ConditionSwitch(
"gender=='masculino'", "boy_sprite.png",
"gender=='feminino'", "girl_sprite.png",
"gender== 'não binário/outro'", "nb_sprite.png")

Code: Select all

scene classe
    show Professora
    with Dissolve (.5)


    p "Bom turma, como todos sabem, hoje nós temos a nossa primeira prova!
    espero que tenham estudado!"

    q "Caramba! Esqueci que tinha prova hoje, espero que a professora
    pegue leve."
    ##I want the side image to appear for q which is the player but it just doesn't
ps: I put q's image as "mysprite" cause it was the only way the game recognized as the right image with the variable, is that what's wrong?
and if I use show it works fine just not side image
please help, what am I doing wrong

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Help with side image witch conditionswitch

#2 Post by Imperf3kt » Thu Jun 30, 2022 10:55 pm

You've defined "q" as both a character object and an image.

Try changing one of them

Code: Select all

define q = Character("[name]", color= "#00008B", image="mysprite")

image mysprite = ConditionSwitch(
"gender=='masculino'", "boy_sprite.png",
"gender=='feminino'", "girl_sprite.png",
"gender== 'não binário/outro'", "nb_sprite.png")

image side mysprite = ConditionSwitch(
"gender=='masculino'", "boy_sprite.png",
"gender=='feminino'", "girl_sprite.png",
"gender== 'não binário/outro'", "nb_sprite.png")
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

yasminuscula
Newbie
Posts: 7
Joined: Tue May 24, 2022 9:15 pm
Contact:

Re: Help with side image witch conditionswitch

#3 Post by yasminuscula » Fri Jul 01, 2022 2:38 pm

....
Last edited by yasminuscula on Fri Jul 01, 2022 2:40 pm, edited 1 time in total.

yasminuscula
Newbie
Posts: 7
Joined: Tue May 24, 2022 9:15 pm
Contact:

Re: Help with side image witch conditionswitch

#4 Post by yasminuscula » Fri Jul 01, 2022 2:39 pm

Imperf3kt wrote:
Thu Jun 30, 2022 10:55 pm
You've defined "q" as both a character object and an image.

Try changing one of them

Code: Select all

define q = Character("[name]", color= "#00008B", image="mysprite")

image mysprite = ConditionSwitch(
"gender=='masculino'", "boy_sprite.png",
"gender=='feminino'", "girl_sprite.png",
"gender== 'não binário/outro'", "nb_sprite.png")

image side mysprite = ConditionSwitch(
"gender=='masculino'", "boy_sprite.png",
"gender=='feminino'", "girl_sprite.png",
"gender== 'não binário/outro'", "nb_sprite.png")
I figured it would be something silly like that, I'm very new to coding haha, thank you!! it worked :)
(the side image looks way to big, but i'm sure I can figure that out hehe)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot]