日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Cocos2D學(xué)習(xí)筆記之Animation初始化

Cocos2D學(xué)習(xí)筆記之Animation初始化是本文要介紹的內(nèi)容,主要來學(xué)習(xí)Animation,內(nèi)容不多,汗很詳細,我們來看詳細內(nèi)容,先來看Cocos2DAnimation的初始化的兩種方式:

成都創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比湘陰網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式湘陰網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋湘陰地區(qū)。費用合理售后完善,十載實體公司更值得信賴。

(1).采用多張貼圖

 
 
  1. Animation walkAnimation = [Animation animationWithName:@"walk" delay:0.1f];    
  2. or(int i = 1; i < 5; i++)    
  3. {    
  4.  [walkAnimation addFrameWithFilename:[NSString stringWithFormat:@"walk_%02d.png", i]];    
  5. }    
  6. id animate = [Animate actionWithAnimation:walkAnimation];    
  7. RepeatForever *rep = [RepeatForever actionWithAction:animate];    
  8.      
  9. self runAction:rep];  

(2).采用一張貼圖(動作幀序列)

 
 
  1. CCSpriteSheet *mgr = [CCSpriteSheet spriteSheetWithFile:@"flight.png" capacity:5];    
  2.  CCSprite* flight = [CCSprite spriteWithTexture:mgr.texture rect:CGRectMake(0,0,31,30)];    
  3.  flight.position = ccp(300, 0);    
  4.  flight.scale = 1.1;    
  5.  flight.anchorPoint = ccp(0.0f, 0.0f);    
  6.  [mgr addChild:flight z:1 tag:99];    
  7.             
  8.  CCAnimation *animation = [CCAnimation animationWithName:@"flight" delay:0.2f];    
  9.  for(int i = 0; i < 3; i++)     
  10.  {    
  11.     int x= i % 3;    
  12.     [animation addFrameWithTexture:mgr.texture rect:CGRectMake(x*32, 0, 31, 30) ];    
  13.  }    
  14.  id action = [CCAnimate actionWithAnimation: animation];    
  15. [flight runAction:[CCRepeatForever actionWithAction:action]];  

小結(jié):Cocos2D學(xué)習(xí)筆記之Animation初始化的內(nèi)容介紹完了,希望本文對你有所幫助!


網(wǎng)頁名稱:Cocos2D學(xué)習(xí)筆記之Animation初始化
鏈接分享:http://www.dlmjj.cn/article/djohdod.html