SachinKS 2013-07-08 05:20 采纳率: 0%
浏览 1941
已采纳

corona sdk 移动对象问题

下面的代码在场景中移动对象。但是引起内存泄露,并且没有响应。

//transition back
local function goBack( )
    transition.to ( wall2, { time = 10000, x = 100, y = 310, onComplete = startTransition})
    transition.to ( wall, { time = 10000, x = 700, y = 200, onComplete = startTransition})
    transition.to (gate_a, { time = 10000, x = 100, y = 255, onComplete = startTransition})
    transition.to ( stargate_a, { time = 10000, x = 100, y = 255, onComplete = startTransition})
end    
//transition start
function startTransition( )
    transition.to ( wall2, { time = 10000, x = 700, y = 310, onComplete = goBack})
    transition.to ( wall, { time = 10000, x = 100, y = 200, onComplete = goBack})
    transition.to ( gate_a, { time = 10000, x = 700, y = 255, onComplete = goBack})
    transition.to ( stargate_a, { time =10000, x = 700, y = 255, onComplete = goBack})
end    
startTransition()

怎么样解决内存泄露的问题?

  • 写回答

1条回答

  • loFataMer 2013-07-08 06:45
    关注
    //transition back
    local function goBack( )
        transition.to ( wall2, { time = 10000, x = 100, y = 310})
        transition.to ( wall, { time = 10000, x = 700, y = 200})
        transition.to (gate_a, { time = 10000, x = 100, y = 255})
        transition.to ( stargate_a, { time = 10000, x = 100, y = 255, onComplete =   startTransition})
     end
     //transition start
     function startTransition( )
        transition.to ( wall2, { time = 10000, x = 700, y = 310})
        transition.to ( wall, { time = 10000, x = 100, y = 200})
        transition.to ( gate_a, { time = 10000, x = 700, y = 255})
        transition.to ( stargate_a, { time =10000, x = 700, y = 255, onComplete = goBack})
     end
    startTransition()
    

    由于所有时间段都一样长,所以不需要全部转变都调用onComlpete

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 一道python难题2
  • ¥15 一道python难题
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备