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.
-
SONTSE
- Regular
- Posts: 95
- Joined: Sun Nov 24, 2013 10:49 pm
- Completed: 8 VN's so far
-
Contact:
#1
Post
by SONTSE » Thu Feb 14, 2019 4:12 pm
Let's say I have a screen with a draggable object inside
Code: Select all
screen say(who, what):
style_prefix "say"
drag:
drag_name 'screen_say'
window:
id "window"
if who is not None:
window:
id "namebox"
style "namebox"
text who id "who"
text what id "what"
and I want it to move into a certain position, ideally with ease effect something like
Code: Select all
e 'and now i move your draggable say screen!'
show screen_say:
ease .5 pos (0,400)
pause 1
e 'see? it's moving. It's alive!'
unfortunately it seems transforms cannot be applied directly on screens, and I have no idea of how to approach the drag within a screen. So I would be thankful for any suggestions!
Last edited by
SONTSE on Fri Feb 15, 2019 11:32 am, edited 1 time in total.
Look! It's moving. It's alive. It's alive... IT'S ALIVE! Oh, in the name of God! Now I know what it feels like to be God!(@Henry_Frankenstein. Sums up my coding style)
-
Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
-
Contact:
#2
Post
by Remix » Thu Feb 14, 2019 9:32 pm
Maybe (untested)
$ renpy.get_widget( "say", "screen_say" ).snap( 0, 400, 0.5 )
-
SONTSE
- Regular
- Posts: 95
- Joined: Sun Nov 24, 2013 10:49 pm
- Completed: 8 VN's so far
-
Contact:
#3
Post
by SONTSE » Fri Feb 15, 2019 11:32 am
Remix wrote: ↑Thu Feb 14, 2019 9:32 pm
Maybe (untested)
$ renpy.get_widget( "say", "screen_say" ).snap( 0, 400, 0.5 )
Thanks! That surely did lead to a working solution.
Although it won't work like this because no say screen is shown when $ scripts are executed,
hence get_widget returns None instead of a widget.
So there is some tricky way to actually get this done.
Code: Select all
init python:
def drag_move(drag):
try:
drag.snap(0,400,delay=.5)
except:
pass
screen move_drag:
default say_drag = renpy.get_widget('say','drag')
timer 1 action Function(drag_move,say_drag)
screen say(who, what):
on 'show' action Show('move_drag')
drag:
style_prefix "say"
drag_name "screen_say"
id "drag"
yalign 1.0
window:
id "window"
if who is not None:
window:
id "namebox"
style "namebox"
text who id "who"
text what id "what"
label main_menu:
return
label start:
'Look! It\'s moving!'
'It\'s alive!'
return
Look! It's moving. It's alive. It's alive... IT'S ALIVE! Oh, in the name of God! Now I know what it feels like to be God!(@Henry_Frankenstein. Sums up my coding style)
Users browsing this forum: Google [Bot]