Android Multiple touch on mobile

sefi331

Member
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