Hello i am making an spaceship game and having my ship shoot all the time without pushing a button all good so long:
local function playerShoot() bullet = display.newRect( sceneGroup, ship\_menu.x - 5, ship\_menu.y - 50, 2, 20 ) bullet:setFillColor( 1,1,1 ) transition.to( bullet, {y = \_T - bullet.height, delay = 5, time = 500, onComplete = playerShoot} ) end
But when i move my ship sideways the shots fired don’t keep up. The shots gets fired besides the ships cannon, is where a better way to do this?
local shipController = function ( event ) if (event.phase == "moved") then ship\_menu.x = event.x end end Runtime:addEventListener( "touch", shipController )
Kind regards
/Isak