i want to destroy the balls when i touch… this is my code (i am very noob)[code]
– add physics engine, start up the engine, and apply gravity
local physics = require(“physics”)
physics.start()
– Set gravity to act “down” (ie, toward the bottom of the device )
physics.setGravity (0, 9)
–set background image
local background = display.newImage( “background.jpg” )
–set ball to stage and position
local function spawnBall()
local ball =display.newImage(“bead2.png”)
ball.x = math.random ( 320 )
ball.y = -100
– turn ball into physics body
physics.addBody(ball,{bounce = 0.1 } )
end
timer.performWithDelay( 500,spawnBall,50)
–add floor image and position
local floor = display.newImage(“bar.png”)
floor.y = display.contentHeight/1.03
– turn floor into physics body
physics.addBody(floor,“static”) [import]uid: 179948 topic_id: 31552 reply_id: 331552[/import]
