Cocos2d-xJS_01-216x300

cocos2d-x javascript no.3 スプライトの大きさの変更

スプライトの大きさの変更
var sprite = cc.Sprite.create(“ball.png”);
sprite.setTextureRect(cc.rect(0,0,100,100));

アンカーポイント
sprite.setAnchorPoint(0.5, 0.5);

ポジション
sprite.setPosition(size.width / 2, size.height / 2);

カラー
sprite.setColor(cc.color(128,0,0));

シーンに追加
this.addChild(sprite, 5);

コメントを残す

メールアドレスが公開されることはありません。