so im trying to learn how to use :applyLinearImpulse, i have the code from the corona sdk examples, this part of code creates a bunch of boxes and randomly shows them at the top of the screen and gravity pulls them down to the ground, now my question is, how would i apply a button so that every time i press the button the box that is right above it goes up a couple of pixels and then starts falling again? i dont want all the boxes to go up unless the button is right underneath it, thanks
local newCrate = function()
rand = math.random( 50 )
local crate
if (rand < 51) then
crate = display.newImage(“crate.png”);
crate.x = 60 + math.random( 160 )
crate.y = -100
physics.addBody( crate, { density=0.9, friction=0.3, bounce=0.3} )
--crate.angularVelocity=math.random(800-400)
--crate.isSleepingAllowed=false
end
crate:addEventListener(“touch”,removeBody)
end
local dropCrates = timer.performWithDelay( 200, newCrate, 100 )