Impulse and buttons

I need to add an impulse to a physical body that scales with a button. I really need help. Thanks to everyone who reads this.

[lua]

function myButton:tap (event)

   if ( myButton.gettingTime == false ) then

      myButton.gettingTime = true

      myButton.markTime = system.getTimer()

   elseif ( myButton.gettingTime == true ) then

      myButton.gettingTime = false

      secondsPassed = system.getTimer() - myButton.markTime

   end

end

 

myButton:addEventListener(“tap”, myButton)

local secondsPassed myButton.gettingTime = false   

function myButton:tap (event)    

if ( myButton.gettingTime == false ) then       

myButton.gettingTime = true       

myButton.markTime = system.getTimer()    

elseif ( myButton.gettingTime == true ) then       

myButton.gettingTime = false       

secondsPassed = system.getTimer() - myButton.markTime

setGravity(0, secondsPassed*9.8)

physics.addBody(ball, whiteballdata:get(“ball”))

    

end 

end

[/lua]

Hello,

Have you studied the documentation on impulse?

http://docs.coronalabs.com/daily/api/type/Body/applyLinearImpulse.html

Brent

Hello,

Have you studied the documentation on impulse?

http://docs.coronalabs.com/daily/api/type/Body/applyLinearImpulse.html

Brent