ATL in ConditionSwitch not working [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
Posts: 32
Joined: Thu Jan 04, 2018 12:42 pm

ATL in ConditionSwitch not working [Solved]

#1 Post by ReDZiX » Wed Jan 10, 2018 10:02 am

Hello, I'm new to Ren'Py, and I've been studying the documentation and examples for a while. I've been able to figure out most of how Ren'Py works so far but there's something I haven't been able to do yet, so I'd like to ask for help.

The basic idea is: I show the player some facedown cards that they can click on. If the player hovers a card, it is flipped and reveal it's image, and I want this to have a sort of flip effect. So I made the card images using ConditionSwitch, with a variable to check if the card is being hovered or not. The problem is applying the transform to the card, IN the condition Switch. I thought of using At(), and it is shown allright, but the transform is never applied.

So, I'm guessing I'm doing something wrong or I just can't combine At with ConditionSwitch, so, I'm open to suggestions, alternatives. Here's what I have so far:

Code: Select all

#Some card images
image card_heart_a = "A_treb.jpg"
image card_back = "card_back.jpg"

#Transforms to apply to a card being flipped
transform hflip_in:
    xzoom 0
    linear .2 xzoom 1

transform hflip_out:
    linear .2 xzoom 0

#A ConditionSwitch Image
image ace_of_hearts = ConditionSwitch(
                      "a_h_hovered", At("card_heart_a", hflip_in), #<- Problem here, ATL not working
                      "True", "card_back"

# Test variable used in the ConditionSwitch
default a_h_hovered = False 

#A test screen
screen xtest():
    #Add the image, not an imagebutton for now
    add 'ace_of_hearts' at truecenter

    #A textbutton to text flip effect
    textbutton "Flip Me":
        align (.5,.7)
        hovered SetVariable("a_h_hovered", True) #Set the condition to True
        unhovered SetVariable("a_h_hovered", False)
        action NullAction()

label start:

    scene black

    call screen xtest
Last edited by ReDZiX on Thu Jan 11, 2018 9:25 am, edited 1 time in total.

Posts: 32
Joined: Thu Jan 04, 2018 12:42 pm

Re: ATL in ConditionSwitch not working

#2 Post by ReDZiX » Thu Jan 11, 2018 9:24 am

OK, I sort of solved it myself. Since I realized ConditionSwitch isn't the best way to do this, I just used a different screen with if-else conditioning, and it works!

So I guess I'll mark this as solved for now.

Post Reply

Who is online

Users browsing this forum: No registered users