Hello, there is a simple code which turn on a function for creating objects. Why does it makes 4 objects instead 2??? I tried other way with tables but result is same!
function createMultipleBalls(num)
for i=1, num do
shotBall = display.newImage(“shot_ball.png”)
shotBall.xScale = 0.7
shotBall.yScale = 0.7
shotBall.x = math.random(50,500)
shotBall.y = math.random(50,500)
shotBall:addEventListener(“touch”, dragBalls)
end
end
function touchScreen(event)
ki=2
if event.phase == “ended” then
–[[mBall:removeSelf()
createBall()–]]
Runtime:removeEventListener(“enterFrame”, fadeInReady)
mBall.enterFrame = bobUp
Runtime:addEventListener(“enterFrame”, mBall)
createMultipleBalls(2)
stopReady()
end
end