Android Multi touch for piano

Discussion in 'Legacy GameMaker Community Tech Support' started by issam, Mar 16, 2019.

  1. issam

    issam Member

    Joined:
    Aug 5, 2016
    Posts:
    51
    Hello,
    I make a simple piano by game maker 1.4, I use about 24 keys as a keybourd each object work by left press as event to play the sound, How can I make 3 buttons at least to play at the same time please?

    Edit:
    I use the following code in each object but not working:

    for(device=0;device<=4;device+=1){
    if (device_mouse_check_button_pressed(device,mb_left)) && position_meeting(mouse_x,mouse_y,self)
    {
    audio_play_sound(name, 10, false);
    }
     
    Last edited: Mar 16, 2019
  2. Ali Al - Mosawi

    Ali Al - Mosawi Member

    Joined:
    Jun 20, 2016
    Posts:
    28
    Hi issam how are you , you can use virtual keys functions
     
  3. issam

    issam Member

    Joined:
    Aug 5, 2016
    Posts:
    51
  4. Ali Al - Mosawi

    Ali Al - Mosawi Member

    Joined:
    Jun 20, 2016
    Posts:
    28
    Yes I was understood you , In sound sure No problem to play multi sounds in same time , but you need the multi pressing in same time
    you can try it
    Code:
    button1 = virtual_key_add(32, 32, 64, 64, ord("A"));
    button2 = virtual_key_add(32, 32, 64, 64, ord("B"));
    button3 = virtual_key_add(32, 32, 64, 64, ord("C"));
    
    you need to change postitions and width & height for each button
    and update keys in step event for same example
    Code:
    button1=keyboard_check(ord('A'))
    button1=keyboard_check(ord('B'))
    button3=keyboard_check(ord('B'))
    
    and to play sound you can check
    Code:
    if button1
    {
    audio_play_sound(sound0,0,0);
    }
    that all
    cheers
     
  5. issam

    issam Member

    Joined:
    Aug 5, 2016
    Posts:
    51
    Thank you Ali, I will try it out later, thanks again
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice