Page 1 of 1

Making a screen that shows results one by one

Posted: Mon Mar 30, 2020 10:03 am
by goldo
Hi guys,

I am trying to create a specific screen animation that displays the results of an interaction (like stat X up by Y, gold and XP made...) one after the other. Basically it's like a vbox, with each element fading in after the other. Cherry on top would be to have a brief 'tadaa' sound playing as each result shows.

I'm guessing using ATL inside the screen would be best, but I have no clue exactly how to go about it.

I'm guessing it would look something like this:

Code: Select all

screen result_screen:

    has vbox

    text "Results" bold True

    text "Strength: +" + str(strength_bonus) at magic_transform # fades in after 1 second, playing sound
    text "XP: +" + str(xp_bonus) at magic_transform # fades in after 2 second, playing sound
    text "Gold: +" + str(gold_bonus) at magic_transform # fades in after 3 second, playing sound
My problem is that I have no idea how to write the "magic_transform" part or how to add a timer to make it happen each after the other (or how to play a sound at the same time, for that matter).

If you could point me in the right direction, a quick code example would be awesome... Thank you!

Re: Making a screen that shows results one by one

Posted: Mon Mar 30, 2020 11:24 am
by Per K Grok
goldo wrote:
Mon Mar 30, 2020 10:03 am
Hi guys,

I am trying to create a specific screen animation that displays the results of an interaction (like stat X up by Y, gold and XP made...) one after the other. Basically it's like a vbox, with each element fading in after the other. Cherry on top would be to have a brief 'tadaa' sound playing as each result shows.

I'm guessing using ATL inside the screen would be best, but I have no clue exactly how to go about it.

I'm guessing it would look something like this:

Code: Select all

screen result_screen:

    has vbox

    text "Results" bold True

    text "Strength: +" + str(strength_bonus) at magic_transform # fades in after 1 second, playing sound
    text "XP: +" + str(xp_bonus) at magic_transform # fades in after 2 second, playing sound
    text "Gold: +" + str(gold_bonus) at magic_transform # fades in after 3 second, playing sound
My problem is that I have no idea how to write the "magic_transform" part or how to add a timer to make it happen each after the other (or how to play a sound at the same time, for that matter).

If you could point me in the right direction, a quick code example would be awesome... Thank you!

I'm not quite sure exactly what the result you are looking for are, but maybe there are something in the following that could be useful.

Code: Select all

default tid=0

screen result_screen:


    vbox:

        text "Results" bold True
        if tid==0:
            text "Strength: +" + str(strength_bonus)        # at magic_transform # fades in after 1 second, playing sound
        elif tid==1:
            text "XP: +" + str(xp_bonus)                    # at magic_transform # fades in after 2 second, playing sound
        elif tid==2:
            text "Gold: +" + str(gold_bonus)                # at magic_transform # fades in after 3 second, playing sound


        if tid==2:
            timer 2.0 action [SetVariable("tid", 0),  Play(0,"sound/BUZZ01.ogg")] 
        else:
            timer 2.0 action [SetVariable("tid", tid + 1),  Play(0,"sound/BUZZ01.ogg")] repeat True

Re: Making a screen that shows results one by one

Posted: Mon Mar 30, 2020 1:03 pm
by goldo
Thanks! That helps with the text and sound part. :)

I will try that with ATL and report on how it's going.

Re: Making a screen that shows results one by one

Posted: Mon Mar 30, 2020 8:56 pm
by philat
There is a delayed_blink transform in the skip_indicator screen (which shows three blinking triangles on repeat during skipping) which should be helpful on the ATL front.