I have a simple code.
I want to make the all fall again everytime.
I use collision and physics.
I used the logic and the commands I found on Corona Docs.
but it’s not working.
I do need your help.
Thank you for your help in advanced.
this is the code
local physics = require "physics" physics.setDrawMode( "normal" ) -- "debug" -- "hybrid" -- "normal" physics.start() local function makeBall() ball = display.newCircle(300, 20, 30) ball.name = "ball" physics.addBody( ball, "dynamic", { density = 1.0, friction = 0.1, bounce = .9, radius = 17} ) end local function onCollisionRect(self, event) if event.other.name == "ball" then physics.start( false ) display.remove( ball ) makeBall() physics.start( true ) end end rect = display.newRect(200, 700, 300, 10) physics.addBody( rect, "static", { density = 1.0, friction = 0.1, bounce = .9} ) rect.collision = onCollisionRect rect:addEventListener("collision", rect) makeBall()
The ball falls fine, the first time
then I remove the ball fine
recreate a new one
and no physics…
thanks again