First of all, thank you for your responses.
Below shows an example function for the blue button showed in the video. There are 4 button functions each with their respective color and is identical in operation except the colors are different. ( Below shows blueButt for blue button, but there are also yellowButt, greenButt and redButt)
local blueButt function blueButt() basketsIdx = 3 basket:removeSelf() basket = display.newImage("Blue Basket.png") basket.x = centerX basket.y = display.contentHeight + 25 basket.xScale = 4 physics.addBody(basket,"static") basket.type = "blue" basket.collision = basketCollision yellowButton:addEventListener("tap", yellowButt) redButton:addEventListener("tap", redButt) greenButton:addEventListener("tap", greenButt) basket:addEventListener("collision", basket) end
Here shows the collision function called;
function basketCollision(self,event) if (event.phase == "began") then if (event.target.type == event.other.type) then event.other:removeSelf() audio.play(scoreIncreaseAudio) score = score + 1 if (score \> 5) then physics.setGravity(0,6.0) elseif (score \> 10) then physics.setGravity(0,8.0) elseif (score \> 15 ) then physics.setGravity(0,10.0) elseif( score \> 25)then physics.setGravity(0,12.0) end displayScore:removeSelf() displayScore = display.newText(score, 0, 0,"Chintzy CPU Shadow BRK", 50 ) displayScore.x = centerX displayScore.y = 10 elseif (event.target.type ~= event.other.type) then physics.setGravity(0,15) event.target:removeSelf() timer.cancel(dropsTimer) youLose() end end end
Any help will be appreciated
Thank you again so much for taking the time to reply to my original message!
Darren.