Urgent Help Needed - Image 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
Izzayuh
Newbie
Posts: 15
Joined: Sat Mar 19, 2016 12:06 am
Projects: Masked, Lovetale
Tumblr: izzycle
Deviantart: izzysdoodles
Contact:

Urgent Help Needed - Image Buttons

#1 Post by Izzayuh »

It's 5:30 am here in England and I have been trying to code something for my university project due today but have been having such brain fog that I can't figure out the coding! (I am usually not the best anyway as I am new to this, but have been really bad fibromyalgia wise the last week and running on no sleep to get all this done, so please be understanding of this! Have sat through the cookbook for hours trying to figure this out on my own)
I want to have 3 image buttons on a page at once, I have 12 images which are separated between these three buttons. I want it so that when the button is clicked, the image changes to the next one on the list.
Can anyone give me some quick help for this! Very stressed out as I haven't been able to figure it out at all! What would the coding be to define each of the images to these three buttons, and then what would I need to use to switch to the next on the list? I would want these looped as well!
The layout to the buttons on the page would be around, but may play about to see what looks good:
One button would be at xalign 0.0, yalign 0.0
The next at xalign 0.5, yalign 0.5
and the next at xalign 0.0, yalign 1.0

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: Urgent Help Needed - Image Buttons

#2 Post by Kia »

what part of the code is done?
did you make your screen?
did you add your image?
did you add three buttons?
did you list your images?

User avatar
Izzayuh
Newbie
Posts: 15
Joined: Sat Mar 19, 2016 12:06 am
Projects: Masked, Lovetale
Tumblr: izzycle
Deviantart: izzysdoodles
Contact:

Re: Urgent Help Needed - Image Buttons

#3 Post by Izzayuh »

Kia wrote:what part of the code is done?
did you make your screen?
did you add your image?
did you add three buttons?
did you list your images?
This is all the coding so far, I have the background and music sorted as well as a timer to stop the scene when the song is finished. I have all the images listed, but I can't figure out how to add the buttons and how to have the images listed to one of the three buttons

Code: Select all

image blossom = "amaryllis.png"
image woodpecker = "bird.ogv"
image bomb = "bomb.png"
image canary = "canary.ogv"
image clone = "clone.png"
image cogs = "cog.ogv"
image drum = "drum.png"
image fire = "fire.png"
image gun = "gun.png"
image snowflake = "snowflake.png"
image sign = "warningsign.png"
image movie = Movie(size=(1280, 720), xpos=0, ypos=0, xanchor=0, yanchor=0)
transform alpha_dissolve:
    alpha 0.0
    linear 0.5 alpha 1.0
    on hide:
        linear 0.5 alpha 0
init:
    $ timer_range = 0
    $ timer_jump = 0
label start:
    scene black
    with Pause(1)
    play movie "background.ogv" loop
    show movie with dissolve
    play music "02 Dance Or Die.mp3" noloop
    $ time = 193
    $ timer_range = 193
    $ timer_jump = "endcredits"
    show screen countdown 
    hide movie with dissolve
    jump endcredits
    return
    label endcredits:
        #enter credits here
        return

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: Urgent Help Needed - Image Buttons

#4 Post by Kia »


User avatar
Izzayuh
Newbie
Posts: 15
Joined: Sat Mar 19, 2016 12:06 am
Projects: Masked, Lovetale
Tumblr: izzycle
Deviantart: izzysdoodles
Contact:

Re: Urgent Help Needed - Image Buttons

#5 Post by Izzayuh »

Kia wrote:you need a screen for that https://www.renpy.org/doc/html/screens.html
okay and what would the screen do? how would I use to make buttons with multiple images?

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: Urgent Help Needed - Image Buttons

#6 Post by Kia »

you can lay your buttons, images and code needed in it. try making it step by step

User avatar
Izzayuh
Newbie
Posts: 15
Joined: Sat Mar 19, 2016 12:06 am
Projects: Masked, Lovetale
Tumblr: izzycle
Deviantart: izzysdoodles
Contact:

Re: Urgent Help Needed - Image Buttons

#7 Post by Izzayuh »

Kia wrote:you can lay your buttons, images and code needed in it. try making it step by step
Trying but not getting any further, I think I'm not able to think it through logically, like I don't understand what steps need to be taken...
so I'd state 3 screens where I'd want the buttons? call them like "Screen 1" "2" "3" in the specific places?

User avatar
Izzayuh
Newbie
Posts: 15
Joined: Sat Mar 19, 2016 12:06 am
Projects: Masked, Lovetale
Tumblr: izzycle
Deviantart: izzysdoodles
Contact:

Re: Urgent Help Needed - Image Buttons

#8 Post by Izzayuh »

Think I'm so stressed out I can't think through this clearly, need to be in uni in 3 hours, and have none of this sorted when I feel like it should be really simple.
But I just can't make sense of what I'm meant to do

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: Urgent Help Needed - Image Buttons

#9 Post by Kia »

have you made your screen yet? what about your imagebuttons? https://www.renpy.org/doc/html/screens.html#imagebutton

Post Reply

Who is online

Users browsing this forum: Google [Bot]