[SOLVED] Moving screen textbuttons/text around the window

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
zMattbari33
Newbie
Posts: 5
Joined: Sun Mar 01, 2020 6:47 pm
Contact:

[SOLVED] Moving screen textbuttons/text around the window

#1 Post by zMattbari33 »

Hiya! So... Lately I've been learning how to code, and after a small practicing I managed to write a part for my future visual novel.
But there's a problem.

In the game, I created a screen that makes a sentence appear on the game window. It has one line of text, a textbutton and another line of text.
With this, the player needs to click the textbutton part to proceed.

This is the code

Code: Select all

screen debate:
    hbox:
        yalign 0.5 xalign 0.5
        text "They used the"
        textbutton " matchbox ":
            action Jump("lie_found")
        text "to set fire to the rope!"
So, I was wondering... How do I make this screen move, like, in a predetermined trajectory?
For this one I wanted it to follow a straight line of 45° starting from the top-left corner.

Thank you in advance, and sorry if I wrote in a confusing way... ^^"
Last edited by zMattbari33 on Fri Mar 06, 2020 8:20 pm, edited 1 time in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Moving screen textbuttons/text around the window

#2 Post by Per K Grok »

zMattbari33 wrote: Thu Mar 05, 2020 7:29 pm Hiya! So... Lately I've been learning how to code, and after a small practicing I managed to write a part for my future visual novel.
But there's a problem.

In the game, I created a screen that makes a sentence appear on the game window. It has one line of text, a textbutton and another line of text.
With this, the player needs to click the textbutton part to proceed.

This is the code

Code: Select all

screen debate:
    hbox:
        yalign 0.5 xalign 0.5
        text "They used the"
        textbutton " matchbox ":
            action Jump("lie_found")
        text "to set fire to the rope!"
So, I was wondering... How do I make this screen move, like, in a predetermined trajectory?
For this one I wanted it to follow a straight line of 45° starting from the top-left corner.

Thank you in advance, and sorry if I wrote in a confusing way... ^^"

you could try this

Code: Select all

default a=0

screen debate():
    hbox:
        pos (a,a)
        text "They used the"
        textbutton " matchbox ":
            action Jump("lie_found")
        text "to set fire to the rope!"

    timer 0.05 action SetVariable("a", a+1) repeat True

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Moving screen textbuttons/text around the window

#3 Post by Alex »

Or try to apply a transform to your button

Code: Select all

transform bbtn_tr():
    align(0.0, 0.0)
    linear 5.0 align(1.0, 1.0)

screen debate():
    hbox:
        at bbtn_tr
        text "They used the"
        textbutton " matchbox ":
            action Jump("lie_found")
        text "to set fire to the rope!"
https://www.renpy.org/doc/html/atl.html ... -statement
https://www.renpy.org/doc/html/atl.html

zMattbari33
Newbie
Posts: 5
Joined: Sun Mar 01, 2020 6:47 pm
Contact:

Re: Moving screen textbuttons/text around the window

#4 Post by zMattbari33 »

Alex wrote: Fri Mar 06, 2020 1:43 pm Or try to apply a transform to your button

Code: Select all

transform bbtn_tr():
    align(0.0, 0.0)
    linear 5.0 align(1.0, 1.0)

screen debate():
    hbox:
        at bbtn_tr
        text "They used the"
        textbutton " matchbox ":
            action Jump("lie_found")
        text "to set fire to the rope!"
https://www.renpy.org/doc/html/atl.html ... -statement
https://www.renpy.org/doc/html/atl.html
That worked. Thank you :3

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]