Notify and custom transforms interfere themselves?

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
Adrian_DVL
Regular
Posts: 141
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

Notify and custom transforms interfere themselves?

#1 Post by Adrian_DVL »

So I have a weird problem regarding graphics.
I have different transforms for the Notify screens depending on what I want to notify, like this:

Code: Select all

transform notify_appear:
    xalign .5 ypos 66
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 ypos 56 alpha 0.0

transform notify_money:
    xpos 1284 ypos 66 xanchor 1.0
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 ypos 56 alpha 0.0

transform notify_clef:
    xpos 1556 ypos 66 xanchor 1.0
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 ypos 56 alpha 0.0
But the one that matters here is the notify_money.
The thing is that, when a function is called, the player buys an item and the money decreases. I have a screen that is a bar showing the player's money as a text, like this:

Code: Select all

text "[money]$" pos (1282, 13) xalign 1.0 size 28 color ("#cfff75") at money_update
And I've made another custom transform for the text inside the bar, just to animate it when it's show and when the money changes (it's updated). I'm NOT talking about the notify transform this time. This one, presumably, is not related with the Notify one at all. This is the transform:

Code: Select all

transform money_update:
    on show:
        alpha 0
        linear .2 alpha 0
        linear .8 alpha 1.0
    on update:
        alpha 0
        linear 0.2 alpha 1.0
The problem is: when the money is updated, the player is notified with its correspondent transform and the on update part of the bar transform indeed works too: the money disappears, and 0.2 seconds later, it's fully shown again, BUT when the Notify disappears, after the notify timer finishes (2 seconds), the on update part of the bar transform is executed again, i.e., the money in the bar disappears again and appears again in 0.2 seconds.

Why is that? Am I using the update in a wrong way?

EDIT: I've just realized the transform is executed EVERY time I update any screen in game. Any idea on how can I make an animation when the money is updated?

Post Reply

Who is online

Users browsing this forum: Ocelot