Advertisement
alestane

Untitled

Dec 7th, 2011
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. local allBalls = {}
  2.  
  3. local function destroyBall(ball)
  4.     allBalls[ball] = nil
  5.     ball:removeSelf()
  6. end
  7.  
  8. function newBall(x, y)
  9.     local ball = display.newGroup()
  10.         ball.x, ball.y = x, y
  11.     ball.shadow = display.newImage(ball, "shadow.png")
  12.         ball.shadow.x, ball.shadow.y = 3, 3
  13.     ball.image = display.newImage(ball, "ball.png")
  14.         ball.image.x, ball.image.y = 0, 0
  15.     physics.addBody(ball, {bounce=0.6 ,radius=ball.image.width / 2})
  16.     ball.isFixedRotation = true
  17.     allBalls[ball] = ball
  18.     ball.destroy = destroyBall
  19.     return ball
  20. end
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement