help please, so im trying new things with the samples given by corona sdk, so i have this code below,
the first part generates random boxes,
the second part display the ground,
what i want to do is when one of the boxes hits the ground i want to end the game and stop generating boxes how would i do this?
—this code generates random boxes
local newCrate = function()
rand = math.random( 50 )
local crate
if (rand < 51) then
crate = display.newImage(“crate.png”);
crate.x = 50 + math.random( 160 )
crate.y = -100
physics.addBody( crate, dynamic,{ density = 3, friction= .5, bounce = .15} )
–crate.angularVelocity=math.random(800-400)
–crate.isSleepingAllowed=false
end
–This code is the ground
local ground = display.newImage( “ground.png” )
ground.x = 160; ground.y = 445
physics.addBody( ground, “static”, { friction=0.5, bounce = -50} )