If you have called
system.activate( "multitouch" )
somewhere in your code, then you should be able to press multiple buttons.
To answer your question:
“Is there a way to configure the controls to work simultaneously, each one with his own touch event listener?”
If you want each button to have its own listener, then you just create a new listener for that button.
Below, I’ve made one function to handle both the left and right buttons, and another one to handle the power button.
I haven’t tested it, but as long as you have activated multitouch first, it should work.
local playerPower = 1 local function pressDirectionButton(event) myPlayer.x = myPlayer.x + (event.target.direction \* playerPower) end local function pressPowerButton(event) playerPower = 5 end local function releasePowerButton(event) playerPower = 1 end leftButton = widget.newButton { defaultFile = "leftUp.png", overFile = "leftDown.png", width = 100, height = 30, label = "Left", labelColor = { default = { 255, 255, 255 }, over = { 60, 60, 60 } }, font = native.systemFont, fontSize = 14, emboss = false, onPress = pressDirectionButton, } leftButton.direction = -1 rightButton = widget.newButton { defaultFile = "rightUp.png", overFile = "rightDown.png", width = 100, height = 30, label = "Right", labelColor = { default = { 255, 255, 255 }, over = { 60, 60, 60 } }, font = native.systemFont, fontSize = 14, emboss = false, onPress = pressDirectionButton, } rightButton.direction = 1 powerButton = widget.newButton { defaultFile = "powerUp.png", overFile = "powerDown.png", width = 100, height = 30, label = "POWER!", labelColor = { default = { 255, 255, 255 }, over = { 60, 60, 60 } }, font = native.systemFont, fontSize = 14, emboss = false, onPress = pressPowerButton, onRelease = releasePowerButton, }
You’ll obviously need to adjust it to work for you, but hopefully the general idea will help you out.