Running a transform on click? - Solved
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.
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.
- Springroll Games
- Newbie
- Posts: 13
- Joined: Fri Mar 17, 2017 3:49 pm
- Contact:
Running a transform on click? - Solved
I want to have a button rotate when it's clicked.
Is there any way to run a transform when a button is clicked, or is the best way to show and hide the buttons so they can have on show/hide transforms?
Thank you.
Is there any way to run a transform when a button is clicked, or is the best way to show and hide the buttons so they can have on show/hide transforms?
Thank you.
Last edited by Springroll Games on Sun Dec 31, 2017 7:56 pm, edited 1 time in total.
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Running a transform on click?
Code: Select all
default degs = 0
init python:
def make_rotate():
global degs
degs += 40
transform rotary(degrees=0):
subpixel True
linear 1.0 rotate degrees
screen button_test():
textbutton _("Push Me") action Function(make_rotate) at rotary(degs)
label start:
show screen button_test()
"This is a tester showing how to have a button that rotates when clicked."
returnA Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- Springroll Games
- Newbie
- Posts: 13
- Joined: Fri Mar 17, 2017 3:49 pm
- Contact:
Re: Running a transform on click?
Wow, thank you so much! This is perfect. I would never have thought of that, but it makes so much sense!
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Running a transform on click? - Solved
Hm...you know what? Here is a shorter version of the code that cuts out the function and just updates the degrees directly:
Code: Select all
default degs = 0
transform rotary(degrees=0):
subpixel True
linear 1.0 rotate degrees
screen button_test():
textbutton _("Push Me") action SetVariable("degs", degs + 40) at rotary(degs)
label start:
show screen button_test()
"This is a tester showing how to have a button that rotates when clicked."
returnA Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- Springroll Games
- Newbie
- Posts: 13
- Joined: Fri Mar 17, 2017 3:49 pm
- Contact:
Re: Running a transform on click? - Solved
Sweet. I never quite know how Renpy's actions really work ^^; Thanks again!
Who is online
Users browsing this forum: Bing [Bot], Ocelot
