deathkiller / jazz2

🎮 · Jazz² Resurrection: Open-source reimplementation of Jazz Jackrabbit 2
https://deat.tk/jazz2/
GNU General Public License v3.0
495 stars 18 forks source link

Disable touch roll-over on specific virtual dpad buttons #60

Closed trigonated closed 2 years ago

trigonated commented 2 years ago

As mentioned in issue #58, I suggest implementing a way to only allow touch roll-over (moving the finger between buttons without lifting) on some specific buttons (dpad left and right). This way, the player can change direction without lifting the finger, but will still have to lift and press the finger to touch the other dpad buttons, avoiding accidental presses on the up and down buttons while changing direction. I believe this change will make playing on touchscreens much easier, especially while changing direction mid-air (as now you won't be able to accidentally trigger a buttstomp).

Regarding implementation, I already have a working implementation, and would be glad to open a pull-request if you aprove of this change.

deathkiller commented 2 years ago

It sounds good. Yes, please, open a pull request. I will take a look in next days (due to holidays).

trigonated commented 2 years ago

I've closed my own pull-request as it looks like this is way harder to implement correctly than I initially thought: only enabling rollover between left and right works great for on-foot controls, but it makes controlling the player with the flying modifiers really awkward and clunky.

The solution is to have only left/right rollover on the normal player state and up/down/left/right rollover when the player has a modifier, however I'm having a hard time figuring out how to access the player's active modifier from the input logic (InnerView.Input.cs). Is there even any way to do this (access the player from InnerView)?

deathkiller commented 2 years ago

Added Player.CanMoveVertically. It should be possible to use bool canMoveVertically = (Scene.Current is LevelHandler handler && handler.Players.Count > 0 && handler.Players[0].CanMoveVertically); from InnerView now, at least for temporary solution.

trigonated commented 2 years ago

Thanks! I'll work on this. Hopefully this now makes the game easier to play on touch on all situations.

trigonated commented 2 years ago

Created a new pull-request with a new, improved implementation of the button-specific rollover. It now enhances the controls in all situations, instead of only on foot (and making them worse when flying).

deathkiller commented 2 years ago

Merged. Thanks!