It looks like you're new here. If you want to get involved, click one of these buttons!
-- setup Virtual Pad vPad = CTNTVirtualPad.new(stage, "images/Minigames/CEO/M1/Controle/tntskinpad", PAD.STICK_SINGLE, PAD.BUTTONS_ONE, 20,2) vPad:setTextures(PAD.COMPO_BUTTON1, "buttona.png","buttonb.png") vPad:setJoyStyle(PAD.COMPO_LEFTPAD, PAD.STYLE_CLASSIC) vPad:setJoyAsAnalog(PAD.COMPO_LEFTPAD, false) vPad:setJoyAsAnalog(PAD.COMPO_RIGHTPAD, true) --vPad:setICade(false) vPad:start() function leftJoy(e) if e.data.power > 0.2 then player:move(e.data.angle, (e.data.power*150)*e.data.deltaTime) end end function rightJoy(e) if e.data.selected then player:setRotation(math.deg(e.data.angle*.786)+90) end end function fire(e) if e.data.state == PAD.STATE_BEGIN then local fire = CLASS_fire.new(player.xPos, player.yPos-20) stage:addChild(fire) end end function protection(event) if event.data.state == PAD.STATE_DOWN then player.protection:setVisible(true) else player.protection:setVisible(false) end end vPad:addEventListener(PAD.LEFTPAD_EVENT, leftJoy, self) vPad:addEventListener(PAD.BUTTON1_EVENT, protection, self) vPad:addEventListener(PAD.BUTTON2_EVENT, protection, self) |
Comments
Likes: asakharov, ar2rsawseen, AxlFlame, MoKaLux
Likes: AxlFlame, vitalitymobile, MoKaLux
Thanks @vitalitymobile for the answer and @ar2rsawseen for the explanation!
Likes: vitalitymobile