I need a variable that can change according to the object’s radius, which is changing all the time…
this is the code
function newBall(ref)
bT={}
refY=ref.y-70
ball=display.newCircle(ref.x, refY,20)
ball.alpha=0.5
ball:setReferencePoint(display.CenterReferencePoint)
physics.addBody(ball, “static”, {isSensor=true})
–this is the part where I transition the original circle
function ballIncrease()
tweenReference = transition.to( ball, {time=2000, xScale=9, yScale=9} )
end
function ballReturn()
transition.to( ball, {time=100,xScale=1, yScale=1} )
transition.cancel(tweenReference)
end
function removeBallref()
for i = #bT, 1, -1 do
local object = bT[i]
local child = table.remove(bT, i)
if child ~= nil then
child:removeSelf()
child = nil
end
end
end
function ballRef(ball)
bx=ball.x
by=ball.y
ballref=display.newCircle(bx,by,ballRad) --this is the part where i create the circle reference and need its radius
ballref.myName=“ball”
ballref.alpha=0.5
table.insert(bT,ballref)
physics.addBody(ballref,“static”, {isSensor=true})
ballref.myName=“ball”
return ballref
end
function onTouch( event )
if(event.phase == “began”)then
ballIncrease()
elseif (event.phase == “ended” or event.phase == “cancelled”) then
ballReturn()
ballRef(ball)
timer.performWithDelay(30,removeBallref)
end
end
Runtime:addEventListener( “touch”, onTouch )
return ball
end