Screen Imagebutton help... total noob here...

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
lucy
Lucy-Class Veteran
Posts: 103
Joined: Wed Feb 11, 2009 5:07 am
Location: Stuck in a cave
Contact:

Screen Imagebutton help... total noob here...

#1 Post by lucy » Thu Nov 25, 2010 12:51 am

I swear I really wanted to learn how to use screens... really...

So in my attempt to figure out how screen image button works (and hopefully use them in the future) I decided to do a little test using screens with the following objectives in mind.
Show a BG graphic with dissolve

Pause for 1 second

Then show an imagebutton "above" the previously displayed BG Graphic with hover and idle state graphics with dissolve at roughly 100pixels away from top and left side with the graphic anchored at it's top left side that jumps to a label named "testing"

Pause for 1 second

Then show an imagebutton "above" the previously displayed BG Graphic with hover and idle state graphics with dissolve at roughly 300pixels away from top and left side with the graphic anchored at it's top left side that jumps to a label named "testing"

Once clicked any of the buttons, you'd be magically teleported to label testing and be greeted by a text message "Test text"
So I used every little bit of processing power I could squeeze out of my brain to try and comprehend this wonderful thing called screens to do the things I've mentioned above... with disastrous results...

Code: Select all

label c:
    show background_graphic with dissolve
    $ renpy.pause(1.0, hard=True)
    
    screen imagebutton_test:
        xpos 100 ypos 100:
        xanchor 0.0 yanchor 0.0
            imagebutton auto "abox_hover.png", "abox_hover.png" action jump('testing') with dissolve

        $ renpy.pause(1.0, hard=True)

        xpos 300 ypos 300:
        xanchor 0.0 yanchor 0.0
            imagebutton auto "bbox_hover.png", "bbox_hover.png" action jump('testing') with dissolve
            
label testing:
    "Test text"
    return
So... here I am humbly begging to get me out of this mess and create a working example that I can use as a stepping stone to achieve screen awareness...

Help anyone?

"POOF" (Sits like a good puppy and waits)
Image

broken_angel
Veteran
Posts: 322
Joined: Sun Oct 03, 2010 11:49 pm
Completed: Memoirs of an Angel (2010)
Projects: Memoirs of an Angel (Remake); W.I.S.H
Location: United States
Contact:

Re: Screen Imagebutton help... total noob here...

#2 Post by broken_angel » Thu Nov 25, 2010 1:09 am

Well...I'm not sure how much I can help (and perhaps I shouldn't be posting at all), but...

First of all, defining a screen is the same as defining a label. So the first thing you'll want to do is define your screen outside of where you want it to be. However, it's not like a label in that you can define transitions...I think. It's just an overlay layer, not actual script. So if you want your buttons to show at different times, then you'll need to make them two separate screens or designate which one should be shown using if statements.

Example (as PyTom posted in another thread, anyway...I have yet to test it myself):

Code: Select all

screen imagebutton_test1:
    imagebutton:
        idle "abox_idle.png"
        hover "abox_hover.png"
        xpos 100 ypos 100
        action Jump('testing')

screen imagebutton_test2:
    imagebutton:
        idle "bbox_idle.png"
        hover "bbox_hover.png"
        xpos 300 ypos 300
        action Jump('testing')

label c:
    show background_graphic with dissolve
    $ renpy.pause(1.0, hard=True)

    show screen imagebutton_test1
    with dissolve
    #? I think I tried doing transitions like this with a screen before and it didn't work, but...you can try it.
    
    $ renpy.pause(1.0, hard=True)

    show screen imagebutton_test2
    with dissolve

label testing:
    "Test text"
    return

Post Reply

Who is online

Users browsing this forum: Google [Bot]