Can someone help me on this code i am trying to multiply the score by two if “double” collides with “penguin” .
[lua]local function spawnDouble()
if( spawnTrue == true )then
local randomPos = math.random ( 0, 480 )
double = display.newImage( “x2.png” )
double.x = randomPos
double.y = -100
double.myName = “double”
physics.addBody(double , “dynamic”, {isSensor = true, radius = 15})
localGroup:insert( double )
end
end
doubleTimer = timer.performWithDelay( 1500, spawnDouble, 0 )
local function penguinCollision (event)
if event.phase == “began” and event.other.myName == “double” then
event.other:removeSelf()
score = score * 2
updateScore()
end
end
penguin:addEventListener(“collision”, penguinCollision)
localGroup:insert( double ) [import]uid: 132369 topic_id: 25581 reply_id: 325581[/import]
[import]uid: 132369 topic_id: 25581 reply_id: 103397[/import]