hello everyone
i’m working on a simple game , i have some arrows as buttons for moving and a button for fire ,
i added system.activate( “multitouch” ) but i don’t get calls when i click on my device, when i tap on fire button player stop moving and start firing but i want them both at the same time so plz help me , here is some part of code
system.activate( “multitouch” )
firebtn = display.newImageRect(uiGroup,objectSheet,6,114,114)
firebtn.x=display.contentWidth-120
firebtn.y=baseposdown+95
upbtn = display.newImageRect(uiGroup,objectSheet,5,47,59)
upbtn.x = 115
upbtn.y =1135
local function fire()
local newbullet= display.newImageRect(mainGroup,objectSheet,20,4,13)
physics.addBody( newbullet, “dynamic”, { isSensor=true } )
newbullet.isBullet = true
newbullet.myName = “bullet”
newbullet.x=player.x
newbullet.y=player.y
newbullet.rotation=player.rotation
newbullet:toBack()
newbullet.dmg=dmg1
if(player.rotation==0)then
transition.to( newbullet, { y=basepostop, time=(player.y-basepostop-200), onComplete = function() display.remove( newbullet ) end} )
elseif(player.rotation==90)then
transition.to( newbullet, { x=baseposright, time=(720-player.x-100), onComplete = function() display.remove( newbullet ) end} )
elseif(player.rotation==180)then
transition.to( newbullet, { y=baseposdown, time=(1090-player.y-100), onComplete = function() display.remove( newbullet ) end} )
elseif(player.rotation==270)then
transition.to( newbullet, { x=baseposleft , time=(player.x-baseposleft-200), onComplete = function() display.remove( newbullet ) end} )
end
end
local function moveup(event)
local phase = event.phase
if ( “began” == phase ) then
display.currentStage:setFocus( event.target )
player.rotation=0
player:setLinearVelocity( 0, -140 )
player.isFixedRotation = true
elseif ( “ended” == phase or “cancelled” == phase ) then
player.rotation=0
player:setLinearVelocity( 0, 0 )
player.isFixedRotation = false
display.currentStage:setFocus( nil )
end
return true
end