Slide 27
Slide 27 text
タイオウ
JS_FN("drawDot", js_cocos2dx_CCDrawNode_drawDot, 3,
JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("drawSegment", js_cocos2dx_CCDrawNode_drawSegment, 4,
JSPROP_PERMANENT | JSPROP_ENUMERATE),
• 2系だと描画命令が少ない
• 3系だともう少し増える
• 2系と3系で機能が違うものも多々ある
var fishSp = cc.Sprite.create("RaidBattle/fish_sprite.png");
var fishBody = cc.Sprite.create();
var animeCache = cc.AnimationCache.getInstance();
var fishAnime = animeCache.getAnimation("raidfish");
if(fishAnime == null){
var fish1 = cc.SpriteFrame.createWithTexture(
fishSp.getTexture(), cc.rect(0, 0, 200, 100));
var fish2 = cc.SpriteFrame.createWithTexture(
fishSp.getTexture(), cc.rect(0, 100, 200, 100));
var animFrames = [];
animFrames.push(fish1);
animFrames.push(fish2);
fishAnime = cc.Animation.create(animFrames, 0.05);
animeCache.addAnimation(fishAnime, "raidfish");
}
fishBody.runAction(
cc.RepeatForever.create(cc.Animate.create(fishAnime)));
GL verts: 186
GL calls: 7
57.94 / 0.008