cocos lua 突出显示某个物体

local p = node:getParent();
[[for i=1,4 do
   
   local str =string.format("tree%d",i);
   local x,y=p:getChildByName(str):getPosition()
   
   x = map.mapPos.x + x;
   y = map.mapPos.y + y;
   release_print(tostring( x ).."   "..tostring( y ));
   local sp = cc.Sprite:create("tree_01.png");
   sp:setCameraMask(2);
   sp:setScale(0.5);
   sp:setAnchorPoint(cc.p(0.5,0.5));
   
   sp:setPosition(cc.p(x,y));
   parent.mapCountainer:addChild(sp,2);
    
  local spColor = sp:getColor();
 
  local tineto = cc.TintTo:create(0.5,255,255, 255);
 
  local tinefrom = cc.TintTo:create(0.5, spColor.r/4*3,spColor.g/4*3, spColor.b/4*3);

  local se = cc.Sequence:create(tineto,tinefrom,nil);

  local repeate = cc.RepeatForever:create(se);
  sp:runAction(repeate);
 
  release_print("我的动画执行时没有问题的")

   self.trees[i] = sp;
   



 


   end 

猜你喜欢

转载自blog.csdn.net/u014660247/article/details/72162622