Using Imagebuttons

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
Neunauge
Newbie
Posts: 1
Joined: Wed May 30, 2018 9:17 am
Contact:

Using Imagebuttons

#1 Post by Neunauge » Wed May 30, 2018 9:41 am

Hey everyone,
I'm currently running into problems when trying to use imagebuttons. I'm working with a testproject, so there's nothing much else to it.
This is the code I used:

Code: Select all

label start:
    
    scene sz:
        
        imagebutton:
          xpos 1240
          ypos 500
          idle "images/empty.png"
          hover "images/move.png"
          action Jump('testing')

label testing:
  scene sz_fenster
  a "cool beans, bro"
I want the imagebutton to define an area which, when clicked, will put me through to a new screen.
This is the error message I currently get:
File "game/script.rpy", line 17: Line is indented, but the preceding ATL statement does not expect a block. Please check this line's indentation.
xpos 1240
^
If I change the indentations, I get the following:
File "game/script.rpy", line 16: expected 'comma or end of line' not found.
imagebutton:
^
Since I literally took the imagebutton code from another project and it seems to work there, I don't know what is going wrong. Do I need to declare something? (As you can maybe extrapolate from my written flailing, I am not a programming minded person)

Thanks to everyone who takes the time to look at my headless ramblings.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Using Imagebuttons

#2 Post by kivik » Wed May 30, 2018 11:06 am

You need to use a screen to put your imagebutton in, then you'd show or call the screen to make it visible to the player.

Have a read through the screen documentations and see if it makes sense :)

https://www.renpy.org/doc/html/screens.html

Start with the Screen Language section, then jump to the Screen Statements section.

Post Reply

Who is online

Users browsing this forum: No registered users