Move Namebox Offscreen Before Updating Name

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
I_Am_Boredom
Newbie
Posts: 7
Joined: Thu Oct 29, 2020 6:29 pm
Projects: Danganronpa Fangame (WIP)
IRC Nick: I_Am_Boredom
Contact:

Move Namebox Offscreen Before Updating Name

#1 Post by I_Am_Boredom » Mon Dec 07, 2020 4:34 pm

Hey everyone! I have a question on how to do this. I'm trying to replicate the GUI of a video game, namely Danganronpa 2. Everything looks good in a screenshot, but I just have a small question with the polish.
screenshot0080.png
Whenever the namebox (vertically on the left) is updated to a new name, I want it to move offscreen to the left and update, before returning to it's original position. Anyone have any advice for this? Looking for code specifically.

Thank you!

User avatar
_ticlock_
Veteran
Posts: 393
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Move Namebox Offscreen Before Updating Name

#2 Post by _ticlock_ » Tue Dec 08, 2020 11:59 pm

Hi, I_Am_Boredom,

You can try something like this, although it is a perfect way to do it.

Code: Select all

default namebox_text = "Check - 1"

screen tt(val):
    if namebox_text != val:
        default update = True
    else:
        default update = False
    if update:
        $ update = False
        timer 1.0 action SetVariable('namebox_text', val)
    frame:
        text namebox_text
        at tr

transform tr:
    rotate 90
    on show:
        xpos 200
        linear 1.0 xpos 0
        linear 1.0 xpos 200
    on replace:
        xpos 200
        linear 1.0 xpos 0
        linear 1.0 xpos 200

label start:
    'Line - 1'
    show screen tt('Check - 2')
    'Line - 2'
    show screen tt('Check - 3')
PS: xpos values should be changed (0-> -50) (200 -> 0) to move it offscreen and back to the left side.

User avatar
Braydxne
Regular
Posts: 50
Joined: Tue Aug 08, 2017 4:03 am
Projects: DR: Chains of Trust
Contact:

Re: Move Namebox Offscreen Before Updating Name

#3 Post by Braydxne » Thu Dec 10, 2020 1:58 pm

This thread might help you so you don't have to show a screen on every name change! viewtopic.php?f=8&t=60059&p=534036#p534036
What I would do also is use a transform that starts with it offscreen that slides/fades in ^^

Post Reply

Who is online

Users browsing this forum: No registered users