Hi All,
My code is below.
I want growing my ground object when my ball objects move.
After a while the ball is not grow towards…
What could be the error?
thank you now…
My Code:
[lua]_W = display.contentWidth;
_H = display.contentHeight;
motiony = 0;
speed = 2;
local physics = require( “physics” )
physics.start()
local ball = display.newCircle( 50, 50, 20 )
ball:setReferencePoint(display.TopCenterReferencePoint)
ball.x = _W/2; ball.y = 50;
local ground = display.newRect( 0, 0, 20, 65 )
ground:setReferencePoint(display.TopCenterReferencePoint)
ground.x = _W/2; ground.y = 0
physics.addBody( ground, “static”, { friction=0.5, bounce=0.3 } )
local box = display.newRect( 0, 0, 60, 80 )
box:setReferencePoint(display.TopCenterReferencePoint)
box.x = 160; box.y = 440
box:setFillColor( 255, 0, 0 )
local function stop (event)
if event.phase ==“ended” then
motiony = 0;
end
end
Runtime:addEventListener(“touch”, stop )
local function moveball (event)
ball.y = ball.y + motiony;
ground.height= ball.y + ball.height --ground.height + motiony
end
Runtime:addEventListener(“enterFrame”, moveball)
function box:touch()
motiony = speed;
end
box:addEventListener(“touch”,box)
[/lua]

In your original post you said that the ground object stops growing after a certain time - and more recently you have said that the ball is not touching the ground object. Tell me what it is that you want to happen.
If you generally want the ball to always be on top of the ground and move up/down depending on what value the ground.height is set to, then you need to use physics engine and possible omit the setting of ball.y altogether