MBHaxe icon indicating copy to clipboard operation
MBHaxe copied to clipboard

Camera Input still being read when using buttons on Android

Open MysticAx0lotl opened this issue 2 years ago • 7 comments

The camera will still accept input and move when a button is being held in the Android and (I presume) iOS/Web versions of MBHaxe. This makes the game nearly impossible to control with touch controls. My solution is to turn off camera controls when a button is being held, like most other mobile games with a similar control setup.

Thanks, this port is amazing!

MysticAx0lotl avatar Sep 07 '23 18:09 MysticAx0lotl

After playtesting a bit, I realized my idea may not work, so here's my better suggestion:

  • If the screen is tapped and a button is pressed, lock the camera
  • If the button remains held for more than about a quarter of a second, unlock the camera.

This allows you to still move the camera while bunnyhopping, but single jumps won't mess up the camera. I may see if I can implement this myself, and if so, submit a PR later.

MysticAx0lotl avatar Sep 07 '23 18:09 MysticAx0lotl

This is an intended feature that I took from Marble It Up Mayhem on iOS. It is meant to allow you to turn large angles while holding down a button, making the button double as more sensitive joystick for the camera. As for your suggestion, I thought of another solution that is to add a deadzone - a certain minimum touch movement is required to recognize it, to the button which should fix the single jumps messing the camera.

Does this inconvenience happen in all the versions (MBG, MBP, MBU)?

RandomityGuy avatar Sep 07 '23 19:09 RandomityGuy

As for your suggestion, I thought of another solution that is to add a deadzone - a certain minimum touch movement is required to recognize it, to the button which should fix the single jumps messing the camera.

This is pretty much what I was thinking of above, I just communicated it really poorly 😅

Does this inconvenience happen in all the versions (MBG, MBP, MBU)?

Yes, although it's less of an issue in MBG (for some reason). I haven't tested MBP, but I'm assuming it's the same as MBG.

Another issue I realized I had with the camera is that movement is really choppy. I don't mean it lags my game, I mean it only updates every 2-3 frames instead of every frame.

MysticAx0lotl avatar Sep 07 '23 23:09 MysticAx0lotl

The web versions of MBG/MBP/MBU have been updated with the touch camera deadzone changes. Please test whether the changes are suitable.

Another issue I realized I had with the camera is that movement is really choppy. I don't mean it lags my game, I mean it only updates every 2-3 frames instead of every frame.

This may be due to the non linear curve of the camera: lower values, the exact function being value < 3 ? sgn(value) * |value / 2|^2.7 : value

RandomityGuy avatar Sep 22 '23 18:09 RandomityGuy

Sweet, I'll test and report back as soon as I can!!

MysticAx0lotl avatar Sep 24 '23 20:09 MysticAx0lotl

Any update on this?

RandomityGuy avatar Oct 01 '23 19:10 RandomityGuy

Hey, so sorry for the delay. I've had a pretty insane last few months. Whatever you did to the controls feels great

MysticAx0lotl avatar Jul 20 '24 18:07 MysticAx0lotl