local goRight =true--判断它移动的方向 local function update( )
local x=text:getPosition()
text:setScale(1.5-x/450)
if goRight then
local x,y = text:getPosition()--得到当前的位置
text:setPosition(cc.p(x+1,y))--向右走
--判断它的位置是否大于可视区域width+text宽度/2的位置
if text:getPosition()>origin.x+visibleSize.width-text:getContentSize().width/2*text:getScale() then
goRight=false--如果大于,就让他走下面
end
else
--同理
local x,y = text:getPosition()
text:setPosition(cc.p(x-1,y))
if text:getPosition()
goRight=true
end
end