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 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条