Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Game programming

taps 2, 3 and 4

All about the StoneScript

taps 2, 3 and 4

Postby rusty » 30 Jun 2012, 15:09

hi, i'm having a play with touch sequence on android...

basically i have a hud with 5 labels on it.
i call "input.enableMultiTouch(this.getUser(), true)" in init and set the hud.
then do the following
Code: Select all
function main.onTouchSequenceChange ( nTaps0, nX0, nY0, nTaps1, nX1, nY1, nTaps2, nX2, nY2, nTaps3, nX3, nY3, nTaps4, nX4, nY4 )
--------------------------------------------------------------------------------
   
    local hUser = application.getCurrentUser()
   
   
    local h0 = hud.getComponent(hUser, "touchy_hud.lbl_0")
    local h1 = hud.getComponent(hUser, "touchy_hud.lbl_1")
    local h2 = hud.getComponent(hUser, "touchy_hud.lbl_2")
    local h3 = hud.getComponent(hUser, "touchy_hud.lbl_3")
    local h4 = hud.getComponent(hUser, "touchy_hud.lbl_4")
   
   if(nTaps0 > 0) then
        hud.setComponentPosition(h0, 50 * ( nX0 + 1 ), 50 * ( nY0 + 1 ))
    else
        hud.setComponentPosition(h0, 150, 150)
    end
   
   if(nTaps1 > 0) then
        hud.setComponentPosition(h1, 50 * ( nX1 + 1 ), 50 * ( nY1 + 1 ))
    else
        hud.setComponentPosition(h1, 150, 150)
    end
   
   if(nTaps2 > 0) then
        hud.setComponentPosition(h2, 50 * ( nX2 + 1 ), 50 * ( nY2 + 1 ))
    else
        hud.setComponentPosition(h2, 150, 150)
    end
   
   if(nTaps3 > 0) then
        hud.setComponentPosition(h3, 50 * ( nX3 + 1 ), 50 * ( nY3 + 1 ))
    else
        hud.setComponentPosition(h3, 150, 150)
    end
   
   if(nTaps4 > 0) then
        hud.setComponentPosition(h4, 50 * ( nX4 + 1 ), 50 * ( nY4 + 1 ))
    else
        hud.setComponentPosition(h4, 150, 150)
    end
   
--------------------------------------------------------------------------------
end


but i only get two labels moving about as i touch

i've only had a cursory look at the iPhoneJoypadEmulation sample (hence the coord conversion)

can anyone explain to me the inside track, maybe it's my phone and it only handles 2 touches? or is there something more to know?

merci
rusty
Expert Boarder
Expert Boarder
 
Posts: 106

Re: taps 2, 3 and 4

Postby dbladez » 30 Jun 2012, 21:30

It could just be the phone.

I spent awhile on the same problem awhile back, to then just decide to test on my iPhone and all 4 worked.

With an Android Motorola Atrix I figured it was pretty powerful and would support 4 touch, which it doesn't apparently.

Although I also remember reading a few months back Apple won a lawsuit against google in that they won by prooving they had invented multi-touch and that all Android Devices had to get rid of multi-touch although no clue how that turned out in the end.

Best bet is to search for your phone and see if it supports 4x touch.
User avatar
dbladez
Platinum Boarder
Platinum Boarder
 
Posts: 682
Location: Ontario, Canada


Return to Game programming