Hi All,
I am looking for a way to wait for a mouseclick and then see the coordinates of the click. I was hoping for something nice and easy like:
$ x, y = renpy.waitForMouseClick()
But no such luck it seems.
I found pause and get_mouse_pos() but pause will continue after a keypress as well and I need an actual click.
The use case is a background image with an invisible grid over the top of it. Think of an RPG Maker map. I need the user to click on the image and some areas will activate things and others won't. I am currently porting a game from RPGM so please don't ask me to use that instead.
Wait for a mouse click function
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.
-
FlipTopBin
- Newbie
- Posts: 15
- Joined: Thu Apr 12, 2018 5:55 am
- Contact:
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Wait for a mouse click function
For clicking on areas and get different actions you can use screens, imagemaps with hotspots and maybe buttons.FlipTopBin wrote: ↑Mon Nov 18, 2019 8:36 amHi All,
I am looking for a way to wait for a mouseclick and then see the coordinates of the click. I was hoping for something nice and easy like:
$ x, y = renpy.waitForMouseClick()
But no such luck it seems.
I found pause and get_mouse_pos() but pause will continue after a keypress as well and I need an actual click.
The use case is a background image with an invisible grid over the top of it. Think of an RPG Maker map. I need the user to click on the image and some areas will activate things and others won't. I am currently porting a game from RPGM so please don't ask me to use that instead.
That's worth getting familiar with before you test other solutions.
https://www.renpy.org/doc/html/screens. ... ht=screens
If you want to do something outside the normal renpy solutions these threads might be of some help.
If you are going to use clicks outside buttons or hotspots you need to be aware of the rollback side function.
viewtopic.php?f=51&t=57299
viewtopic.php?f=51&t=53333
But I would recommend to start with imagemap with hotspots.
Who is online
Users browsing this forum: Bing [Bot]