2016년 1월 1일 금요일

Cocos2d-x Sprite change


Cocos2d-x Sprite change



This code will change "CloseNormal_s.png".
But Sprite size will have "CloseNormal.png" size.

my Example code shows sprite like this.


1. Sprite init
(image file name : "arm.png")
(change target file name : "body.png")

code: sprite = Sprite::create("arm.png");







2. Sprite change ended

code:
Texture2D* texture = Director::getInstance()->getTextureCache()->addImage("body.png");
sprite->setTexture(texture);

result sprite shape:











cocos2d-x sprite change end

PS: image sources on "Dr.Robot TEO"'s robot


댓글 없음:

댓글 쓰기

JIRA Plugin - ScriptRunner 소개 #2

관련 글 소개 #1:  https://pineoc.blogspot.com/2019/03/scriptrunner-1.html ScriptRunner 소개 #2 지난 글에서는 Behaviours를 보았고 다음 내용인 콘솔, 리스너 등을 ...