Imagebutton

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
nautilus_nc
Newbie
Posts: 17
Joined: Wed Jan 16, 2019 11:59 pm
Contact:

Imagebutton

#1 Post by nautilus_nc »

Hello! could you tell if there is a way to generate an imagebutton (to go in a secret menu(appers with a random chance)) in the main menu? (His location should be random too)

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Imagebutton

#2 Post by IrinaLazareva »

screens.rpy file:

Code: Select all

default sx = renpy.random.random()
default sy = renpy.random.random()
default sato = renpy.random.randint(0, 99)

screen main_menu():

    ## body of screen main_menu

    if sato < 25:                 ### 25 means that, the button will appear with a ~ 25 percent chance
        imagebutton auto 'm_%s.jpg' align(sx, sy) action Notify('Secret!')
https://www.renpy.org/doc/html/other.html#renpy-random

nautilus_nc
Newbie
Posts: 17
Joined: Wed Jan 16, 2019 11:59 pm
Contact:

Re: Imagebutton

#3 Post by nautilus_nc »

Thx!!!

Post Reply

Who is online

Users browsing this forum: snotwurm