coco stduio lua 帧事件的使用

来源:互联网 发布:动态地图制作软件 编辑:程序博客网 时间:2024/06/15 05:53

最近参加一款休闲游戏, 客户端用的cocos


   

  
       local function  aniBack(frame)
         -- body
      if(frame == nil) then  return end;

         local event = frame:getEvent();



         release_print(tostring( event ));
        

         
       end

        local action  = self.map:getChildByName("node_tree");
        local x,y = action:getPosition();
        local node = cc.CSLoader:createNode("Node.csb");
    --wait()

        node:setPosition(x, y)
        local action = cc.CSLoader:createTimeline("Node.csb");
        node:runAction(action)
        action:setTimeSpeed(1)
        action:gotoFrameAndPlay(0, false)
        release_print("iiiiiiiii !!!");
        
        action:setFrameEventCallFunc(aniBack);
        release_print("iiiiiiiii !!!");
        
       
       -- local frameInternal = 1/60
      --local delayTime =(action:getEndFrame() - action:getStartFrame() + 1) * frameInternal / action:getTimeSpeed()
    
         self.mapCountainer:addChild(node, 100);

  



才开始的时候, 这样掉,是进不去的, 需要在cocos stduio中设置帧事件, 步骤为,先开始记录动画, 然后点击帧, 最后,在帧事件那里写字符串

0 0