screen language: button that once clicked zoom in

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
jack_norton
Lemma-Class Veteran
Posts: 4050
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

screen language: button that once clicked zoom in

#1 Post by jack_norton » Thu Nov 17, 2011 5:42 am

So I wanted to make a new nice screen based gallery for Flower Shop 2, but I have a weird (but probably there's a reason) behavior. I confess I don't get at all how screen works. I mean I know how to use them, but I don't get what kind of drawing loop they use, especially since the code below doesn't work:

Code: Select all

transform move(x1,y1,z1,x2,y2,z2,d):
    xcenter x1 ycenter y1 zoom z1
    linear d xcenter x2 ycenter y2 zoom z2

transform endbutton(x,y):
    xcenter x ycenter y zoom .5
    block:
        linear 2.0 ycenter (y+.01)
        linear 2.0 ycenter (y-.01)
        repeat
screen gallery:
    tag menu
    default zoomend = ""
    add "gfx/mainmenu.jpg"
    add "snow"
    if zoomend!="jacob":
        imagebutton idle (im.Alpha("gfx/endjacob.png",.3)) hover "gfx/endjacob.png" action (SetScreenVariable("zoomend","jacob")) at endbutton(.1,.4)
    else:
        add "gfx/endjacob.png" at move(.1,.4,.5,.5,.5,1.0,2)
    add "gfx/fslogo.png" at mainlogo()
    frame style "default":
        xalign .5 yalign .99
        has hbox spacing 15
        textbutton _("go back to main menu") action Show("main_menu") style "default" text_style "maintxt" 
1. by default, no button is selected (zoomend="")
2. you click on the first (and for now unique) button to set the variable zoomend = "jacob"
3. the button is hidden correctly, but the add statement with the move ATL doesn't work at all. It just pop-ups the sprite at fullsize, ignoring the linear zoom that normally shows up

I'm a failure at screen language. I can code this without problem using the good old label->jump loop, which seems the only way I can code anything interactive in Ren'Py :lol: :lol:
follow me on Image Image Image
computer games

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4050
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: screen language: button that once clicked zoom in

#2 Post by jack_norton » Thu Nov 17, 2011 6:11 am

So I thought I had fixed it using a screen this way:

Code: Select all

transform move(x1,y1,z1,r1,x2,y2,z2,r2,d):
    xcenter x1 ycenter y1 zoom z1 rotate r1
    linear d xcenter x2 ycenter y2 zoom z2 rotate r2

transform endbutton(x,y):
    xcenter x ycenter y zoom .5
    block:
        linear 2.0 ycenter (y+.01)
        linear 2.0 ycenter (y-.01)
        repeat
        
screen endbutton:
    if zoomend!="jacob":
        imagebutton idle (im.Alpha("gfx/endjacob.png",.3)) hover "gfx/endjacob.png" action (SetScreenVariable("zoomend","jacob")) at endbutton(.1,.4)
    else:
        add "gfx/endjacob.png" at move(.1,.4,.5,0,.5,.5,1.0,360,3)
    
screen gallery:
    tag menu
    default zoomend = ""
    add "gfx/mainmenu.jpg"
    add "snow"
    use endbutton(zoomend=zoomend)
    add "gfx/fslogo.png" at mainlogo()
    frame style "default":
        xalign .5 yalign .99
        has hbox spacing 15
        textbutton _("go back to main menu") action Show("main_menu") style "default" text_style "maintxt" 
but now I get an even more fun behavior: depending WHEN I click the button, either I get the right zooming/rotating effect, or the button instantly pops-up at the end position!! :shock:
follow me on Image Image Image
computer games

User avatar
KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: screen language: button that once clicked zoom in

#3 Post by KimiYoriBaka » Thu Nov 17, 2011 1:35 pm

couldn't you just make the pics into imagebuttons that switch to atl to display what's on the screen, then zoom in on the image?

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4050
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: screen language: button that once clicked zoom in

#4 Post by jack_norton » Thu Nov 17, 2011 1:42 pm

I did something like that already and works, but I wanted to try making everything with screens. Maybe is not possible at all?
follow me on Image Image Image
computer games

Post Reply

Who is online

Users browsing this forum: Google [Bot]