see subject. is this possible? I could probably do something like that by using pygame more closely but I was wondering if there's an easier way to do this that I'm not seeing.
in this case I want to use the WASD keys to scroll a viewport. it works now but you have to tap the button to scroll, which is annoying.
repeat action of 'Key' screen element [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.
- Vaendryl
- Regular
- Posts: 39
- Joined: Thu Dec 26, 2013 10:10 pm
- Projects: Sunrider
- Organization: Love in Space
- IRC Nick: vaendryl
- Contact:
repeat action of 'Key' screen element [solved]
Last edited by Vaendryl on Fri Dec 18, 2015 8:23 pm, edited 1 time in total.
Re: repeat action of 'Key' screen element while key is held
Nothing simpler than managing PyGame event comes to mind...
- Vaendryl
- Regular
- Posts: 39
- Joined: Thu Dec 26, 2013 10:10 pm
- Projects: Sunrider
- Organization: Love in Space
- IRC Nick: vaendryl
- Contact:
Re: repeat action of 'Key' screen element while key is held
alright, I'll have to make that then
thanks!
![Smile :)](./images/smilies/icon_smile.gif)
Re: repeat action of 'Key' screen element [solved]
Actually there might be, it just never occurred to me to try, Ren'Py seems to have better handling of pygame input through it's own funcs. I just never messed with that ![Smile :)](./images/smilies/icon_smile.gif)
![Smile :)](./images/smilies/icon_smile.gif)
Re: repeat action of 'Key' screen element [solved]
Something along these lines I guess (prolly needs improvement/corrections):
Code: Select all
screen vp():
viewport:
id "vp"
align (0.5, 0.5)
child_size (1000, 1000)
xysize (300, 300)
draggable True
has vbox xysize (1000, 1000) box_wrap True spacing 50
for i in xrange(100): # <== This causes an error under my pre-released channel Ren'Py version, I've reported it. You can use normal viewport setup...
add Solid("#%06x"%renpy.random.randint(0, 0xFFFFFF), xysize=(100, 50))
$ vpx = renpy.get_widget("vp", "vp").xadjustment if renpy.get_widget("vp", "vp") else None
if vpx:
key "repeat_K_RIGHT" action Function(vpx.change, vpx.value + vpx.step)
key "repeat_K_LEFT" action Function(vpx.change, vpx.value - vpx.step)
# The game starts here.
label start:
call screen vp
- Vaendryl
- Regular
- Posts: 39
- Joined: Thu Dec 26, 2013 10:10 pm
- Projects: Sunrider
- Organization: Love in Space
- IRC Nick: vaendryl
- Contact:
Re: repeat action of 'Key' screen element [solved]
that's really interesting
thanks again!
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Who is online
Users browsing this forum: Google [Bot]