Animating vbox in a screen? (calling a screen from within a screen?)

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
pumpkin spike
Regular
Posts: 76
Joined: Fri Mar 09, 2018 6:13 pm
Projects: A Bureau of Monsters
itch: pumpkin-spike
Location: A Pumpkin Patch
Contact:

Animating vbox in a screen? (calling a screen from within a screen?)

#1 Post by pumpkin spike »

Hello, I'm running into some problems with using screen language. My original goal is to add animated text a screen. Is that possible to do with vbox? Should I be animating each string of text separately? I tried putting the vbox in a separate screen, but I've been having problems calling that from a screen (using Show or ShowTransient). Alternatively, if I could have the text wait to show up after all other animations finished playing within the screen, that would be fine, too.

How would I go about this?
Image
WIP AllxAll game with turn based fighting (Demo 2.0 out!)

Image
WIP Yaoi game Demo 1.0 out! (haitus)

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Animating vbox in a screen? (calling a screen from within a screen?)

#2 Post by DannX »

There are many reasons why your code may not be working, but without seeing it, we cannot help you figure out what is wrong. It would be better if you post the relevant parts of your code, like the screen you're trying to create/modify, and how exactly you want the animations to go.

As for your questions, vbox is just a container for displayables (text, images, etc.) and it can be animated with ATL, or you can animate each element inside separately, both are possible. Making the animation wait should be possible with time ATL statement. For calling a screen from another screen, apart from Show you could also try the use statement, again, not sure without actually seeing your code.

pumpkin spike
Regular
Posts: 76
Joined: Fri Mar 09, 2018 6:13 pm
Projects: A Bureau of Monsters
itch: pumpkin-spike
Location: A Pumpkin Patch
Contact:

Re: Animating vbox in a screen? (calling a screen from within a screen?)

#3 Post by pumpkin spike »

DannX wrote: Mon Oct 29, 2018 2:34 pm There are many reasons why your code may not be working, but without seeing it, we cannot help you figure out what is wrong. It would be better if you post the relevant parts of your code, like the screen you're trying to create/modify, and how exactly you want the animations to go.

As for your questions, vbox is just a container for displayables (text, images, etc.) and it can be animated with ATL, or you can animate each element inside separately, both are possible. Making the animation wait should be possible with time ATL statement. For calling a screen from another screen, apart from Show you could also try the use statement, again, not sure without actually seeing your code.
Sorry ^^; here is the code. I just figured it'd probably be a yes/no situation. I will also read through what you've linked to try something new. Currently, the code outputs have everything animated except the textboxes. They're stationary and appear the moment the screen loads. Here's a screenshot (to avoid stretching the page), I caught it in the middle of the boxes animating. The text is already present on the screen. Ideally, I'd like the text to animate along with the boxes, but if that's not possible, I'll settle for it appearing after the boxes have finished animating.

Code: Select all

screen mcstatsbox: 
    vbox: 
        xpos 25 ypos 40 
        text _("[mcFighter]") size 20                  #both mcFighter and mongen are strings where I put the name of the two characters that are fighting
        text _(" ") size 8
        text _("{b}Level{/b}: [mclvl]") size 15 
        text _(" ") size 8
        text _("{b}HP{/b}: [mchp]/[mcmaxhp]") size 15 

screen monstatsbox: 
    vbox:
        xpos 1021 ypos 40 
        text _("[mongen]") size 20 
        text _(" ") size 8
        text _("{b}Level{/b}: [monlvl]") size 15 
        text _(" ") size 8
        text _("{b}HP{/b}: [monhp]/[monhpmax]") size 15 

screen fight:
    imagemap:
        ground "images/fight_unselect.png"            #This is an imagemap for the fight screen and I jump to other labels. The 
        hover "images/fight_select.png"                 #labels come back to this fight screen at the end of a turn.

        hotspot (234,25,422,354) clicked Call("attack") hover_sound "click.mp3"
        hotspot (683,54,322,308) clicked Call("defend") hover_sound "click.mp3"
        hotspot (306,404,292,255) clicked Call("items") hover_sound "click.mp3"
        hotspot (654,403,281,246) clicked Call("runaway") hover_sound "click.mp3"

    if fightstart == False:                                     #I noticed that after running the screen code once, I'd have all the sprites re-animate 
        add mcfightsprite at Transform:                #itself to appear on the screen. I put a flag in each of the hotspot labels to prevent this. 
            xpos 0                                                  #So everything should appear stationary after the end of a turn.
        add monsprite at Transform: 
            xpos monx ypos mony
        add "gui/lvlbox.png" at Transform: 
            xpos 5 ypos 30 
        add "gui/lvlbox.png" at Transform: 
            xpos 1001 ypos 30 
        vbox: 
            xpos 25 ypos 40                                   #vbox currently has no animation
            text _("[mcFighter]") size 20 
            text _(" ") size 8
            text _("{b}Level{/b}: [mclvl]") size 15 
            text _(" ") size 8
            text _("{b}HP{/b}: [mchp]/[mcmaxhp]") size 15 
        vbox:
            xpos 1021 ypos 40 
            text _("[mongen]") size 20 
            text _(" ") size 8
            text _("{b}Level{/b}: [monlvl]") size 15 
            text _(" ") size 8
            text _("{b}HP{/b}: [monhp]/[monhpmax]") size 15 
    else: 
        add mcfightsprite at mcFightAppear                                #At the start of the fight screen, I have the characters move in with ATL. 
        add monsprite at monsterFightAppear                             #mcFightAppear has the main character sliding up from the bottom. 
        add "gui/lvlbox.png" at mcLvlbox                                    #monsterFightAppear has the monster slide up about a second after the main character.
        add "gui/lvlbox.png" at monLvlbox
        vbox: 
            xpos 25 ypos 40                                                         #vbox currently has no animation
            text _("[mcFighter]") size 20 
            text _(" ") size 8
            text _("{b}Level{/b}: [mclvl]") size 15 
            text _(" ") size 8
            text _("{b}HP{/b}: [mchp]/[mcmaxhp]") size 15 
        vbox:
            xpos 1021 ypos 40 
            text _("[mongen]") size 20 
            text _(" ") size 8
            text _("{b}Level{/b}: [monlvl]") size 15 
            text _(" ") size 8
            text _("{b}HP{/b}: [monhp]/[monhpmax]") size 15 
Image
WIP AllxAll game with turn based fighting (Demo 2.0 out!)

Image
WIP Yaoi game Demo 1.0 out! (haitus)

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Animating vbox in a screen? (calling a screen from within a screen?)

#4 Post by DannX »

Well, you can just attach a transform to the vboxes the same way you do for the images.

Code: Select all

vbox:
    at myTransform
    xpos 1021 ypos 40 
    text _("[mongen]") size 20 
    #omitted the rest to save space
This will animate all of the elements in the vbox at once. myTransform can be any transform you create, you can of course use the same one you used for the boxes images so they all animate at the same time. I'm pretty sure it will still respect the xpos and ypos you define in the vbox itself, but if it doesn't, you can create a transform for each specific vbox.

pumpkin spike
Regular
Posts: 76
Joined: Fri Mar 09, 2018 6:13 pm
Projects: A Bureau of Monsters
itch: pumpkin-spike
Location: A Pumpkin Patch
Contact:

Re: Animating vbox in a screen? (calling a screen from within a screen?)

#5 Post by pumpkin spike »

DannX wrote: Tue Oct 30, 2018 1:26 pm Well, you can just attach a transform to the vboxes the same way you do for the images.

Code: Select all

vbox:
    at myTransform
    xpos 1021 ypos 40 
    text _("[mongen]") size 20 
    #omitted the rest to save space
This will animate all of the elements in the vbox at once. myTransform can be any transform you create, you can of course use the same one you used for the boxes images so they all animate at the same time. I'm pretty sure it will still respect the xpos and ypos you define in the vbox itself, but if it doesn't, you can create a transform for each specific vbox.
So it was a syntax problem :D This worked perfectly! Thank you so much!
Image
WIP AllxAll game with turn based fighting (Demo 2.0 out!)

Image
WIP Yaoi game Demo 1.0 out! (haitus)

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]