Hello I am a Newbie,
I am working on a game where once an object is touched it dissappears. I would like for the score to go up once this is done. Can someone pleasehelp. I read some tutorials but am unsure what to name function. Please help!
local function trackYellow(obj)
obj:removeSelf();
end
local function spawnYellow()
yellow = display.newImage( “yellow.png” )
yellow.x = math.random( 600 )
yellow.y = 450
yellow.xScale = .5
yellow.yScale = .5
function yellow:touch(e)
trackYellow(self);
end
yellow:addEventListener(“touch”, yellow);
physics.addBody( yellow, { density = 1.0, friction = 0.9, bounce = 4 } )
end
timer.performWithDelay( 500, spawnYellow, 60 )
scoreText = display.newText(“0”, 0, 0, Arial, 40)
scoreText:setTextColor(255, 255, 255)
scoreText.x = 500
scoreText.y = 45
local function ()
score = score + 1
scoreText.text = score
end [import]uid: 133869 topic_id: 26582 reply_id: 326582[/import]