Вопрос

I am creating an app in corona that has a button to shoot, reload, and a joystick to move the character around. I want the user to be able to shoot while he/she and be moving the character with the joystick simultaneously. I tried using Corona's built-in multitouch:

system.activate("multitouch")

but it does not seem to have any affect.

Does anyone have any ideas to how I can make the multitouch work, or any other ideas of how I should approach this problem?

Это было полезно?

Решение

Imagine, you are registering event listener on "touch" event:

Runtime:addEventListener("touch", touchManager)

In this event, you have event id, which is differs for different touches during multitap. Here's a part of my code which allows user to move and fire at the same time.

 local function touchManager(event)
        if (event.id == ignore_event_id)  then return;  end; -- should protect when user fired, and the same event messes with joystick
         -- ....
 end
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top