• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android Multiple touch on mobile

S

sefi331

Guest
Hi , I have a problem with multiple touch on mobile - the problem is to go back to device(0) after (1) is pressed or checked. My code:


GML:
   if (device_mouse_check_button_pressed(0,mb_left) or
            device_mouse_check_button(0,mb_left))
              
            {     
                move_0 = true
                move_1 = false
                  
                xx = clamp(device_mouse_x(0), 70, room_width - 70)
                yy = clamp(device_mouse_y(0), 320, room_height - 40)
            }
          
          
            if (device_mouse_check_button_pressed(1,mb_left) or
            device_mouse_check_button(1,mb_left))       
            {
                move_1 = true
                move_0 = false
              
                xx = clamp(device_mouse_x(1), 70, room_width - 70)
                yy = clamp(device_mouse_y(1), 320, room_height - 40)
            }

Now I know that in the moment the screen feels the second tap, the second finger is device 1.
How can I make it so the device will override the second finger and go back to the first one (device 0) when it feels movement there even thou both pressed / checked?

Code:
            if (device_mouse_check_button_pressed(0,mb_left) or
            device_mouse_check_button(0,mb_left))
              
            {     
                move_0 = true
                move_1 = false
                  
                xx = clamp(device_mouse_x(0), 70, room_width - 70)
                yy = clamp(device_mouse_y(0), 320, room_height - 40)
              
              
            }
          
          
            if (device_mouse_check_button_pressed(1,mb_left) or
            device_mouse_check_button(1,mb_left))
          
            {
                move_1 = true
                move_0 = false
              
                xx = clamp(device_mouse_x(1), 70, room_width - 70)
                yy = clamp(device_mouse_y(1), 320, room_height - 40)
          
          
          
          
            if device_mouse_check_button_released(0,mb_left)
            {
            if (device_mouse_check_button_pressed(0,mb_left) or
            device_mouse_check_button(0,mb_left)) and (device_mouse_check_button_pressed(1,mb_left) or
            device_mouse_check_button(1,mb_left))
              
            {     
                move_0 = true
                move_1 = false
                  
                xx = clamp(device_mouse_x(0), 70, room_width - 70)
                yy = clamp(device_mouse_y(0), 320, room_height - 40)
          
            }
          
          
              
            } 
          
        }

But it didn't work for the reason I mentioned.

Thanks for your attention.
 
Top