i want the ball can keep jumping after touch the platform
how come this code does not work?
local stand = display.newRect(0,315,1000,5)
local hero = display.newCircle(40,10,15)
hero.isColidedwithGround = false
local physics = require “physics”
physics.start()
physics.addBody(stand,“static”,{bounce = 0})
physics.addBody(hero,“dynamic”,{bounce = 0})
local function onLocalCollision( self, event )
if event.phase == “began” then
hero.isColidedwithGround = true
–hero:applyForce(0,-2,hero.x,hero.y)
print(hero.isColidedwithGround )
hero:applyLinearImpulse( 0, -0.05, hero.x, hero.y )
–hero:applyForce(0,-2,hero.x,hero.y)
end
print(event.phase)
end
hero.collision = onLocalCollision
print(hero.collision)
hero:addEventListener(“collision”,hero)