Collision questions

SO, I’m trying to do a game similar to BloonsTD but I don’t really know how to do the shooting of projectiles and reaching the end to end the game. Also, this isn’t really important but can anyone show me how to do a YOU WIN screen once the score system reaches a certain point and be unable to go below 0?

Example of my “bloon”:

local widget = require( “widget” )

– Function to handle button events

local function handleButtonEvent( event )

    if ( “ended” == event.phase ) then

moneyCount0 = moneyCount0 + 50

moneyText0.text = moneyCount0

local Round1Zomb1 = display.newImageRect(“Skin3s4.png”, 50, 50)

Round1Zomb1.x = -75

Round1Zomb1.y = 50

physics.addBody( Round1Zomb1, “dynamic”, {radius=25} )

transition.to(Round1Zomb1, {x=35, y=50, time=4000})

function afterTimer()

   transition.to(Round1Zomb1, {x=35, y=100, time=1500})

end

timer.performWithDelay(4000, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=-17, y=100, time=1500})

end

timer.performWithDelay(5500, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=-17, y=250, time=4000})

end

timer.performWithDelay(7000, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=40, y=250, time=1500})

end

timer.performWithDelay(11000, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=40, y=150, time=3000})

end

timer.performWithDelay(12500, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=93, y=150, time=1500})

end

timer.performWithDelay(15500, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=93, y=170, time=750})

end

timer.performWithDelay(17000, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=143, y=170, time=1500})

end

timer.performWithDelay(17750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=143, y=115, time=1500})

end

timer.performWithDelay(19250, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=195, y=115, time=1500})

end

timer.performWithDelay(20750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=195, y=205, time=2000})

end

timer.performWithDelay(22250, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=113, y=205, time=2000})

end

timer.performWithDelay(24250, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=113, y=247, time=1250})

end

timer.performWithDelay(26250, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=235, y=247, time=3000})

end

timer.performWithDelay(27750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=235, y=200, time=1500})

end

timer.performWithDelay(30750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=273, y=200, time=1250})

end

timer.performWithDelay(32250, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=273, y=213, time=500})

end

timer.performWithDelay(33500, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=333, y=213, time=1250})

end

timer.performWithDelay(34000, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=333, y=156, time=1500})

end

timer.performWithDelay(35250, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=263, y=156, time=1500})

end

timer.performWithDelay(36750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=263, y=110, time=1500})

end

timer.performWithDelay(38250, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=363, y=110, time=2000})

end

timer.performWithDelay(39750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=363, y=65, time=1000})

end

timer.performWithDelay(41750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=243, y=65, time=3000})

end

timer.performWithDelay(42750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=243, y=18, time=1000})

end

timer.performWithDelay(45750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=443, y=18, time=5000})

end

timer.performWithDelay(46750, afterTimer, 1)

function afterTimer()

   transition.to(Round1Zomb1, {x=443, y=270, time=8000})

end

timer.performWithDelay(51750, afterTimer, 1)

    end

end

– Create the widget

local button1 = widget.newButton(

    {

        left = 290,

        top = 270,

width = 75,

height = 50,

        id = “button3”,

        defaultFile = “Zom3.jpg”,

        onEvent = handleButtonEvent

    }

)

Hey David, can you rephrase the questions?  I’m having trouble understanding exactly what you are asking.  Also, please repost or edit your code and use the “<>” button in the control panel to make your code format on the page.  Thanks.

You arent really making sense and your code is just a bunch of timers, no collisions anywhere. Look at corona sample apps.

I’m asking HOW I can add it to my coding, I don’t want it to mess up my current coding. So the question is, how do I add a collision code to my coding with the zombies so they disappear once they hit something.

You are probably better off just buying a template (and working out how things are done).

https://marketplace.coronalabs.com/app-templates/mushroom-defense