Hi,
I have a Point & Click segment in the game I am developing.
The Controller functions to move the mouse cursor.
I just need to make "pad_a_press" function exactly as a left click, so no matter where the cursor is on the screen, pressing the A button on Gamepad (and possibly other keys later) just causes the mouse to do a left click.
Anyone know of a simple way to do this?
[Solved] Screen Action for Left Click
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.
- SypherZent
- Veteran
- Posts: 368
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Location: Puerto Rico
- Contact:
[Solved] Screen Action for Left Click
Last edited by SypherZent on Fri Feb 24, 2023 7:43 am, edited 1 time in total.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3808
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Screen Action for Left Click
I would simply place a button over the entire screen, usually by using the background as the button via an image button. Make sure its zorder is below that of other buttons and UI
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- SypherZent
- Veteran
- Posts: 368
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Location: Puerto Rico
- Contact:
Re: Screen Action for Left Click
This is a Point & Click segment of gameplay. It has hidden buttons throughout the screen.
So, I don't need a button. I need to map a Screen Action to the A button on gamepad.
^ Like this.
I just can't find any Screen Actions in the Ren'Py documentation that function exactly like left clicking the mouse.
(Edit: When pressing "A" on Gamepad, I need the game to process where the Mouse Cursor is, detect if there are any buttons at those exact coordinates, just like Left Clicking would do. So, to simplify, I just want to map the exact functionality of a Mouse Left Click to the Gamepad A Button.)
I don't want to have to dig into PyGame documentation.
I'm hoping someone has an elegant solution.
So, I don't need a button. I need to map a Screen Action to the A button on gamepad.
Code: Select all
key "pad_a_press" action ???
I just can't find any Screen Actions in the Ren'Py documentation that function exactly like left clicking the mouse.
(Edit: When pressing "A" on Gamepad, I need the game to process where the Mouse Cursor is, detect if there are any buttons at those exact coordinates, just like Left Clicking would do. So, to simplify, I just want to map the exact functionality of a Mouse Left Click to the Gamepad A Button.)
I don't want to have to dig into PyGame documentation.
I'm hoping someone has an elegant solution.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3808
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Screen Action for Left Click
Oh, sorry I misread.
You'll want to check out the keybinds
https://www.renpy.org/doc/html/keymap.html
You'll want to check out the keybinds
https://www.renpy.org/doc/html/keymap.html
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- SypherZent
- Veteran
- Posts: 368
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Location: Puerto Rico
- Contact:
Re: Screen Action for Left Click
Ren'Py natively has "button_select" keybind on both mouseup_1 and pad_a_press.
However, using pad_a_press is not causing a left-click at mouse coordinates.
Using pad_a_press is activating the first button on the screen.
If basic Ren'Py documentation worked, I would not be on these forums asking for a solution...
My question is simple:
How do I map the mouse's left click functionality to "pad_a_press" using a Screen Action (or using Function with a PyGame function)?
Edit: I found a solution, but I'm still interested in a Screen Action that can cause a Mouse Left Click at current mouse coordinates, if anybody knows how to do that, even if it's the Function() Screen Action using pygame.event.post or something similar, that would be appreciated.|
However, using pad_a_press is not causing a left-click at mouse coordinates.
Using pad_a_press is activating the first button on the screen.
If basic Ren'Py documentation worked, I would not be on these forums asking for a solution...
My question is simple:
How do I map the mouse's left click functionality to "pad_a_press" using a Screen Action (or using Function with a PyGame function)?
Edit: I found a solution, but I'm still interested in a Screen Action that can cause a Mouse Left Click at current mouse coordinates, if anybody knows how to do that, even if it's the Function() Screen Action using pygame.event.post or something similar, that would be appreciated.|
Re: Screen Action for Left Click
Might be wrong, but I think that left click is evaluated on button's side. Like if mouse pointer is over the button or not the button's action will be executed or not. So, there is no left click action. You still can use a function that checks the mouse pointer pos and do stuff according to this as an action (like you did for 'a' key).SypherZent wrote: ↑Fri Feb 24, 2023 7:25 am Ren'Py natively has "button_select" keybind on both mouseup_1 and pad_a_press.
However, using pad_a_press is not causing a left-click at mouse coordinates.
Using pad_a_press is activating the first button on the screen.
If basic Ren'Py documentation worked, I would not be on these forums asking for a solution...
My question is simple:
How do I map the mouse's left click functionality to "pad_a_press" using a Screen Action (or using Function with a PyGame function)?
Edit: I found a solution, but I'm still interested in a Screen Action that can cause a Mouse Left Click at current mouse coordinates, if anybody knows how to do that, even if it's the Function() Screen Action using pygame.event.post or something similar, that would be appreciated.|
- SypherZent
- Veteran
- Posts: 368
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Location: Puerto Rico
- Contact:
Re: [Solved] Screen Action for Left Click
Thanks Alex, I thought about doing it based on positions like you mentioned. It would have been a last resort, but since it would take longer to code that I was looking for a simpler solution. It makes sense that there is no left click action for the reason you mentioned, too. That clarifies things.
Seems the problem I had was a button being focused, so it was a simpler solution than I originally anticipated.
Seems the problem I had was a button being focused, so it was a simpler solution than I originally anticipated.
Who is online
Users browsing this forum: No registered users