달력

5

« 2024/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

auto spr = Sprite::create();

spr->setPosition(Vec2(100, 100));

this->addChild(spr);


//통짜 이미지를 텍스쳐로 등록

auto texture = TextureCache::getInstance()->addImage("아틀라스 파일명.png");


auto animation = Animation::create();

animation->setDelayPerUnit(0.2f);


for (int i=0; i<내부의그림개수; i++)

{

animation->addSpriteFrameWithTexture( texture, Rect(56*(i%3), 80*(i%3), 56, 80) );

//텍스쳐 이름, 텍스쳐 배열의 좌표 점화식

}

spr->runAction(RepeatForever::create(Animate::create(animation)));



예제 코드 및 파일


:
Posted by 웽웽