Moving menu buttons?

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
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Moving menu buttons?

#1 Post by Kinmoku »

Hi all,

I'm just wondering if there's a way to move or distort the menu buttons so they're more difficult to select. Timers too, would make the gameplay quite interesting.

Basically, I'm inspired by Yakuza 0's telephone mini-game, and wondering if Ren'Py can create a similar effect?

https://youtu.be/aliSO4k2X0E

jw2pfd
Regular
Posts: 87
Joined: Tue Sep 18, 2012 9:55 pm
Location: DFW, TX, USA
Contact:

Re: Moving menu buttons?

#2 Post by jw2pfd »

The short answer is yes. This is definitely possible. It uses screen language and ATL. Learn more about those things in these links:
https://renpy.org/doc/html/screens.html
https://renpy.org/doc/html/screen_actions.html
https://renpy.org/doc/html/atl.html

I messed with some code that doesn't provide much functional purpose other than visually showing that you can move buttons around and limit a screen by a timer:

Code: Select all

transform anim:
    
    choice:
        linear 0.5 zoom 2.0
        pause 0.45
        linear 0.5 zoom 1.0
    choice:
        linear 0.5 zoom 0.5
        pause 0.55
        linear 0.5 zoom 1.0        
    choice:
        linear 0.5 xpos 50
        pause 0.6
        linear 0.5 xpos 0
    choice:
        linear 0.5 ypos 50
        pause 0.4
        linear 0.5 ypos 0
    choice:
        pause 1.3
    
    repeat

screen test():
    
    vbox:                    
        align (0.5, 0.5)
        spacing 50
        for i in ['Jump', 'Dodge', 'Fall', 'Hide']:
            textbutton i at anim:
                action Return()
                
    text str(duration/10.0) align (0.5, 0.1)
                
    timer 0.1 action If(duration<=0, Return(), SetVariable("duration", duration-1)) repeat True
    

image gray = "#CCC"

label start:

    $ duration = 100

    scene gray

    call screen test

    return

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Moving menu buttons?

#3 Post by Kinmoku »

Whoa, that's awesome! :D Then my next question is; can transform be more randomised? So it'd be more difficult to click on the buttons? And, can the buttons act freely and animate over the top of one another, instead of pushing the others aside?

jw2pfd
Regular
Posts: 87
Joined: Tue Sep 18, 2012 9:55 pm
Location: DFW, TX, USA
Contact:

Re: Moving menu buttons?

#4 Post by jw2pfd »

Kinmoku wrote:Then my next question is; can transform be more randomised? So it'd be more difficult to click on the buttons?
You can make it as random as you want really. It depends on the type of behavior you want the buttons to exhibit and then could make a transform that does it. I kept my example simplified by using only one transform that applied to all of the buttons. You could also have a different transform for each button.
Kinmoku wrote:And, can the buttons act freely and animate over the top of one another, instead of pushing the others aside?
In my first example, they move each other around because they're in the same vbox. They can be placed on a different screen element like a fixed and then they can overlap. I modified the code from my other post so that they will overlap. Heh, it is a jumbled mess visually, but it shows that buttons can overlap at the very least.

Code: Select all

transform anim:
   
    choice:
        linear 0.5 zoom 2.0
        pause 0.45
        linear 0.5 zoom 1.0
    choice:
        linear 0.5 zoom 0.5
        pause 0.55
        linear 0.5 zoom 1.0       
    choice:
        linear 0.5 xpos 50
        pause 0.6
        linear 0.5 xpos 0
    choice:
        linear 0.5 ypos 50
        pause 0.4
        linear 0.5 ypos 0
    choice:
        pause 1.3
   
    repeat

screen test():
    
    fixed:
        align (0.5, 0.5)
        maximum (200, 200)
        for i in ['Jump', 'Dodge', 'Fall', 'Hide']:
            textbutton i at anim:            
                action Return()
               
    text str(duration/10.0) align (0.5, 0.1)
               
    timer 0.1 action If(duration<=0, Return(), SetVariable("duration", duration-1)) repeat True
   

image gray = "#CCC"

label start:

    $ duration = 100

    scene gray

    call screen test

    return

User avatar
Saltome
Veteran
Posts: 244
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Moving menu buttons?

#5 Post by Saltome »

Lol! What the heck? Now I wanna play that game.
A little warning would have been nice, though. I didn't exactly expect bikini girls.
Deviant Art: Image
Discord: saltome
Itch: Phoenix Start

Post Reply

Who is online

Users browsing this forum: Bing [Bot]