Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local allBalls = {}
- local function destroyBall(ball)
- allBalls[ball] = nil
- ball:removeSelf()
- end
- function newBall(x, y)
- local ball = display.newGroup()
- ball.x, ball.y = x, y
- ball.shadow = display.newImage(ball, "shadow.png")
- ball.shadow.x, ball.shadow.y = 3, 3
- ball.image = display.newImage(ball, "ball.png")
- ball.image.x, ball.image.y = 0, 0
- physics.addBody(ball, {bounce=0.6 ,radius=ball.image.width / 2})
- ball.isFixedRotation = true
- allBalls[ball] = ball
- ball.destroy = destroyBall
- return ball
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement