On Screen Buttons get stuck

retroed

  • Posts: 36
Hi there,

I am having a small issue with the “Onscreen button behaviour”. It works perfectly 95% of the time, but every now and then one of the multitouch on screen buttons gets stuck, so my character will keep spinning or keep moving forward after the button should have been released. This isn’t a scene transition issue as it happens within the one scene.

I’m guessing it could just be a small lag when pressing and releasing multiple buttons quickly, which causes the code to miss a “simulate key release” or something. If I press and release the button that is stuck, it fixes the issue.

I had an idea of trying to fix the button sticking by putting a “do after 2 or 3 seconds – simulate key release” in the “when touched” coding, so if a button is held down it is automatically released after a certain amount of time. However this is not an ideal solution.  The game play is similar to asteroids, so you don’t have to hold down a button for long periods of time to get through it, but I would still like the freedom to do it if possible.

Has anyone had experience with this issue? Or has an idea of how I might fix this? Any advice would be greatly appreciated.

Thanks!

ultram

  • *
  • Posts: 69
I had the same problem if i understand correctly.

So at the start of each scene,  i add this piece of code to initialise all my buttons when the scene start or reload:

When ceated:
-> simulate key "release" control 1
-> simulate key "release" control  2
...

retroed

  • Posts: 36
Thanks for the reply. I have already put in code to stop buttons getting stuck whenever the scene is transitioning or reloading, but the problem is buttons are getting stuck during gameplay within the one scene.

My theory is that with the iPhone, if you keep touching the screen very lightly, it may not detect when the touch ID has been released, so the "simulate key release" code doesn't run and the button gets stuck. It doesn't happen very often but it is an issue that I'd like to fix. So if anyone has any other solutions I'd really appreciate it! :)

hegedusv

  • Posts: 8
I think i have the same problem. My buttons get stuck when im pressing one, then sliding my finger to another button, and the one i was holding first is still reacting as pressed... the only way to make it normal is to press the stucked button again.

Majora64

  • Posts: 536


Solution: Sdieters (I believe) wrote up a tutorial for multi touch behaviors for mobile...Watch it and all of your questions will be answered. After watching his tutorial I was able to get multiple buttons to respond to my input on my iphone with no lag what so ever. This works as a great platform for creating  games that require intricate inputs so I recommend learning this if you plan on going mobile. Cheers


https://www.youtube.com/watch?v=3IT5QfHQnYw

« Last Edit: June 23, 2017, 10:56:55 pm by Majora64 »

squeeb

  • Posts: 1617

Solution: Sdieters (I believe) wrote up a tutorial for multi touch behaviors for mobile...Watch it and all of your questions will be answered. After watching his tutorial I was able to get multiple buttons to respond to my input on my iphone with no lag what so ever. This works as a great platform for creating  games that require intricate inputs so I recommend learning this if you plan on going mobile. Cheers


https://www.youtube.com/watch?v=3IT5QfHQnYw

good find.. is that the only way?  i have a mobile joystick to control actor and swipes to jump.. heres more of my description

Majora64

  • Posts: 536
Im sure swiping works the same way as the tutorial goes over how the phone responds to touch (it goes far deeper than a simulate key behavior). I have not had a single issue using this method. It's great because it's essentially a basic engine for mobile games and each button can be tweaked to do whatever you want it to do (run and jump, jump and shoot, run jump and shoot...etc)...

« Last Edit: June 23, 2017, 11:08:08 pm by Majora64 »

squeeb

  • Posts: 1617
i appreciate it.. ill try it out then..

rob1221

  • *
  • Posts: 9472
I've used that behavior a few times before but I haven't encountered that issue, which makes it difficult to fix.  Is there a way to reproduce the problem consistently?

colburt187

  • *
  • Posts: 2416
Ive used the on screen button behaviour in all my mobile games. I haven't had and real issues with the controls. My latest game Golf Zero had running jumping and swinging a golf club while aiming etc.

retroed

  • Posts: 36
Thanks for the help. I have spent some time testing and I noticed that one of the buttons was getting stuck if I held it down and then slid my finger off screen. I've moved the button so that its boundaries are all on screen and that seemed to fix the problem. I'm not sure if it's completely fixed my 'stuck button' problems so I'll keep testing.

retroed

  • Posts: 36
Update on my problem (PLEASE HELP):

So there are a few ways that cause the "stuck buttons". If I quickly slide my finger from one button to another (if they are next to each other), then the button I slid from will get stuck (e.g. my character will start spinning around in circles) and the only way to unstick the button is by pressing it again. Also, if I hold down a button and drag my finger off it, and if at the same that my finger leaves that button's region I tap another button, then the the button I slid from gets stuck.

As I mentioned before, the button also got stuck if it was too close to the edge of the screen and I slid my finger from the buttons region to off the screen. But that problem was easy to fix.

What's interesting is that I can't replicate these issues when I test on my old android phone, but when I use my iPhone SE it tends to happen. So it's as if the android phone's processing isn't quick enough for the buttons to get stuck.

This problem is hard to replicate and doesn't happen often, but I really would like to solve it. Is there any code I could create to unstick the buttons? Or any other solutions? I've attached a picture that shows what the buttons look like (see bottom of the picture) and if you'd like to try the game yourself, here are links to the free games:

https://itunes.apple.com/au/app/note-shooter-lite/id1244416455?mt=8
https://play.google.com/store/apps/details?id=com.retroed.noteshooterlite