Hey guys,
I am creating a 2D zombie shooter and have been having trouble switching the direction from the right side of the screen to the left. Here is my shoot function where I spawn the bullets along with set the X and Y.
function shoot() local function collided(event) local phase = event.phase local other = event.other local function listener() display.remove(other) changeScore(1000) end if other.type=="zom" and phase == "began" then other:setSequence("dead") other:play() timer.performWithDelay( 750, listener ) else end end local new\_bullet = display.newCircle( level1, gun.x, gun.y, 5 ) new\_bullet.x = gun.x + 80 new\_bullet.y = gun.y - 17 local function move\_bullet() new\_bullet.x = new\_bullet.x + 30 if(new\_bullet.y \< 0) then new\_bullet:removeSelf( ) else timer.performWithDelay( 30, move\_bullet , 1 ) end end physics.addBody( new\_bullet, "dynamic" ) new\_bullet.isSensor = true new\_bullet.gravityScale = 0 new\_bullet:addEventListener("collision", collided) timer.performWithDelay( 33, move\_bullet , 1 ) end