carenalgas / popochiu

Godot plugin to make point n' click games in a similar way to tools like Adventure Game Studio and Power Quest.
MIT License
154 stars 15 forks source link

Added double click support #198

Closed anthonyirwin82 closed 2 months ago

anthonyirwin82 commented 3 months ago

I wanted to be able to use a double click function on hotspots to be able to have an exit hotspot instantly change rooms instead of having to wait for the character to walk there.

Added _on_double_click() to work the same as _on_click() and _on_right_click functions do.

anthonyirwin82 commented 3 months ago

These changes seem to work fine and should be good to be reviewed again.

To avoid the character walking somewhere else when clicking on the screen when multiple say commands are run by the player I had to put the player say text into a cutscene.

mapedorr commented 3 months ago

After making a couple of tests I'm gonna say I don't like the delay after clicking on things. I would like to see if we can reduce it to 0.1 or even lower. Additionally, with this approach, skipping the animation of the dialogue lines for characters when clicking anywhere on the screen stopped working. That causes the character to move while saying a dialogue line (and I don't like the idea of forcing players to use cutscenes).

Taking these changes as a starting point, I'd like to experiment a bit tomorrow to see if I can reach a solution. If I find that it's going to require many changes, I think the most appropriate course of action will be to remove the wait (and all the awaits related with the click/tap), merge the PR, and then spend more time solving the problem. Something tells me that the root cause lies in a recent change I made in how clicks are detected in PopochiuClickables.

anthonyirwin82 commented 3 months ago

When I was looking at default millisecond delay and found that Windows was 500 milliseconds and tested that it was painful, that's why I lowered it. I tested what you said about making it 0.1 and found that I sometimes had a single click and double click event come through.

When I tested 0.2 as a value, I did not get any extra unwanted click events and did not notice any delay in movement.

Another thing to think about is we are going to need a click and hold event to have the verb coin interface where you click and hold on a hotspot then a verb coin pops up with the different interaction types.

People making touch screen games may also what a two finger tap and hold to show all the game hotspots. I have also seen single tap and hold on the player character show all the hotspots.

Other events people may want is to have wheel mouse up and down to show or hide the inventory bar.

This is all stuff that visionaire studio can do so is probably something to add at some point. I have attached a screenshot for settings of the mouse control options that I had for a verb coin game. This screen is the global defaults for controlling the game then you had the ability to access the different mouse events on individual hotspots to write custom actions to occur when executed on the hotspot.

visionaire-mouse-events

I have not used popochiu enough to know how the dialog text worked prior to me making changes for the double click. I am pretty sure other engines disable mouse clicking when dialog is playing unless they use a say_background() or something which allows normal gameplay to continue while text is being displayed. This allows a character locked in a jail cell to say something random like "please get me out of here", or a loudspeaker announcing things but does not stop the player from moving.

mapedorr commented 3 months ago

I tested the update, and 0.2 seconds feel better. We can keep that delay by now while we check if there is a way to avoid it.

We don't disable the mouse while the dialog lines are showing, the GUI just captures the click and stops its propagation. But with the delay that stopped working.

We'll have a say_background() in future versions because other devs have been asking for it. Meanwhile, and before merging your PR, I want to address the issue with the dialog lines. Perhaps after releasing version 2, we can add a configuration option where you can specify whether dialogue lines should or should not block the character's movement, but for now, I would like it to remain as it has worked so far. Here's an example of the desired behavior:

https://github.com/carenalgas/popochiu/assets/4536477/6f52ec0c-51f7-4978-8049-3188b1c84c05

Another issue I found is that, if you move the cursor after clicking anywhere in the room, the target direction changes if one moves the cursor before the character starts walking:

https://github.com/carenalgas/popochiu/assets/4536477/541cf323-20e4-40be-ba78-db94b8f80fe0