plist使用

재대로 완료가 되었네요.web

 

<IMG style="BORDER-BOTTOM: rgb(0,0,0); BORDER-LEFT: rgb(0,0,0); BORDER-TOP: rgb(0,0,0); CURSOR: pointer; BORDER-RIGHT: rgb(0,0,0)" id=20130528_6/dlehddus84_13697504426271cgcD_PNG/7.png class=_photoImage onclick="popview(this, '90000003_0000000000000004B34B4E52')" alt="" src="http://postfiles7.naver.net/20130528_6/dlehddus84_13697504426271cgcD_PNG/7.png?type=w2" width=740 height=503>post

 

파일을 확인합니다.this

 

 

<IMG style="BORDER-BOTTOM: rgb(0,0,0); BORDER-LEFT: rgb(0,0,0); BORDER-TOP: rgb(0,0,0); CURSOR: pointer; BORDER-RIGHT: rgb(0,0,0)" id=20130528_58/dlehddus84_1369750935629YVsGr_PNG/8.png class=_photoImage onclick="popview(this, '90000003_0000000000000004B34B4E52')" alt="" src="http://postfiles11.naver.net/20130528_58/dlehddus84_1369750935629YVsGr_PNG/8.png?type=w2" width=740 height=503>spa

 

그럼 이 파일을 cocos2d-x 프로젝트의 리소스에 추가합니다..net



<IMG style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-TOP: medium none; CURSOR: pointer; BORDER-RIGHT: medium none" id=20130528_163/dlehddus84_1369750935905W8ivG_PNG/11.png class=_photoImage onclick="popview(this, '90000003_0000000000000004B34B4E52')" alt="" src="http://postfiles4.naver.net/20130528_163/dlehddus84_1369750935905W8ivG_PNG/11.png?type=w2" width=740 height=444>orm

 

plist 파일도 확인해봅니다.blog

 

 

본문 내용에 아래와 같이 작성합니다.get

 

  CCSpriteFrameCache *Cache = CCSpriteFrameCache::sharedSpriteFrameCache();
  Cache->addSpriteFramesWithFile("w_bear.plist");animation

  CCSprite *w_bear = CCSprite::createWithSpriteFrameName("w_bear01.png");it

  w_bear->setPosition(ccp(100, 100));
 
  CCSpriteFrame *frame1 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("w_bear01.png");
  CCSpriteFrame *frame2 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("w_bear02.png");
  CCSpriteFrame *frame3 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("w_bear03.png");
  CCSpriteFrame *frame4 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("w_bear04.png");
 
  CCArray *frame = new CCArray;
  frame->addObject(frame1);
  frame->addObject(frame2);
  frame->addObject(frame3);
  frame->addObject(frame4);

  CCAnimation *animation = CCAnimation::createWithSpriteFrames(frame, 0.3);
  CCAnimate *animate = CCAnimate::create(animation);
  CCAction *action = CCRepeatForever::create(animate);

  w_bear->runAction(action);

  this->addChild(w_bear); 

 

에뮬레이터를 실행해봅니다.

 

<IMG style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-TOP: medium none; CURSOR: pointer; BORDER-RIGHT: medium none" id=20130528_206/dlehddus84_1369752717583n1cKC_GIF/1.gif class=_photoImage onclick="popview(this, '90000003_0000000000000004B34B4E52')" alt="" src="http://postfiles15.naver.net/20130528_206/dlehddus84_1369752717583n1cKC_GIF/1.gif?type=w2" width=496 height=358>

 

재대로 동작하네요.

 

 

리소스 최적화에 많이 도움이 될 것 같습니다.

 

[출처] Texture packer 다운로드 / 사용법|작성자 우리집드래곤뽀삐

相關文章
相關標籤/搜索