minigame: realtime key press retrieval
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.
-
- Newbie
- Posts: 9
- Joined: Fri Jan 02, 2015 6:41 am
- Contact:
minigame: realtime key press retrieval
I've been mucking about trying to create some simple code to have some realtime keypress retrieval for a game/games I have in mind but I can't find any good examples. I can detect that an even has a occured but I can't get any further than that. HELP!!!
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: minigame: realtime key press retrieval
You need to explain in detail what you're trying to do.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Newbie
- Posts: 9
- Joined: Fri Jan 02, 2015 6:41 am
- Contact:
Re: minigame: realtime key press retrieval
Ok I'll try and be more specific. I need to be able to access the status of keys that are currently held down or released. For the purpose of realtime interaction (NOT turn based or the like) I'm interested in monitoring specific keys probably the space bar and maybe the wasd keys. Accessing duration would be good but it's not the most important thing. any specific questions about my question?
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: minigame: realtime key press retrieval
There's two ways to do it. The best way is to use a creator-defined displayable, and look at the KEYDOWN and KEYUP events. That provides ordering information. You can also use pygame.key.get_pressed().
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Newbie
- Posts: 9
- Joined: Fri Jan 02, 2015 6:41 am
- Contact:
Re: minigame: realtime key press retrieval
thanks I'll see if I can get it working either of those ways.
probably try the get key first
probably try the get key first
-
- Newbie
- Posts: 9
- Joined: Fri Jan 02, 2015 6:41 am
- Contact:
Re: minigame: realtime key press retrieval
oh wait maybe not I already tried this method and the get key command caused a freeze
Who is online
Users browsing this forum: Bing [Bot]