Better notification system help

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
richycapy
Regular
Posts: 51
Joined: Mon May 27, 2019 8:53 pm
Organization: EN Productions
Location: Mexico
Contact:

Better notification system help

#1 Post by richycapy » Sat Jun 01, 2019 11:40 pm

Hi you all

Here is a what I think is a simple question for you most advanced users

I created this small notification system, here is the example:
Image

And the code is:

Code: Select all

screen notificacion(message, tipo):
    zorder 100

    fixed:
        area 1035, 80, 620, 200
        add "images/gui/notify-[tipo].png"
        hbox:
                yalign 0.09
                xalign 0.03
                text _('{size=17}{color=#ffffff}[message]{/color}{/size}')

    timer 3.25 action Hide('notificacion')
And you use it like this:

Code: Select all

show screen notificacion('hola', 'love-down')
Is there a way to animate it? Disolve in, disolve out?

I know it has something to do with transform, but I cant seem to make it work :(

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

Re: Better notification system help

#2 Post by Imperf3kt » Sat Jun 01, 2019 11:46 pm

ATL is your solution here.

Something like:

Code: Select all

transform dissolve_screen:
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 alpha 0.0

screen notificacion(message, tipo):
    zorder 100

    fixed at dissolve_screen:
        area 1035, 80, 620, 200
        add "images/gui/notify-[tipo].png"
        hbox:
                yalign 0.09
                xalign 0.03
                text _('{size=17}{color=#ffffff}[message]{/color}{/size}')

    timer 3.25 action Hide('notificacion')
    
This should make the screen fade in from invisible to completely visible, over the course of 0.25 seconds and then fade out to completely invisible over 0.5 seconds once hidden
Last edited by Imperf3kt on Sun Jun 02, 2019 3:52 am, edited 1 time in total.
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

User avatar
richycapy
Regular
Posts: 51
Joined: Mon May 27, 2019 8:53 pm
Organization: EN Productions
Location: Mexico
Contact:

Re: Better notification system help

#3 Post by richycapy » Sat Jun 01, 2019 11:57 pm

That's perfect! thanks a lot!

Now that I know how is implement it... I modify it a bit so now it moves up while appearing, and down while disappearing for anybody out there looking
for somethink like this.

Code: Select all

transform dissolve_screen:
    on show:
        ypos 100
        alpha 0
        linear .25 alpha 1.0 ypos 80
    on hide:
        linear .25 alpha 0.0 ypos 100

Post Reply

Who is online

Users browsing this forum: Bing [Bot]