Hi, Im getting along quite well with corona but Im stumped on collisions etc.
I have the following code to spawn bullets and enemy ships, they are in 2 separate functions and from looking at the collision help, it seems like objects you want to collide must be created in the same function. Im new to corona so I might be completely wrong. If anyone can help please do!
function fire()
local bullet = display.newCircle( ship.x, ship.y, 3 )
gamescreen:insert( 2, bullet )
laserchannel = audio.play( laser )
transition.to(bullet, { time = 500, x = centreX, y = centreY, width = 0.25, height = 0.25, onComplete = destroyHoop } )
end
function spawnobst(event)
if dospawnE == 1 then
Enemylane = mRand(1,2)
local ship = display.newImage(“shipafterburner.png”)
gamescreen:insert( 1 , ship )
ship.alpha = 0.2
ship.xScale = 0.01
ship.yScale = 0.01
ship.x = centreX
ship.y = centreY
I have skipped some bits of code as it would be a big post, but is there anyway of making a bullet in the first function collide with the ship in the second function?
Thanks [import]uid: 8699 topic_id: 5409 reply_id: 305409[/import]