Monday, 26 August 2013

Cocos2d - HTML5 Sprite Sheet - Sprite not displayed

Cocos2d - HTML5 Sprite Sheet - Sprite not displayed

1 )I'm preloading intro1.plist
{type:"plist",src:"intro1.plist"},
2) In the main class I'm adding sprite frames like that:
var cache = cc.SpriteFrameCache.getInstance();
cache.addSpriteFrames("intro1.plist", "intro1.png");
3) I'm creating sprite
var sp = cc.Sprite.createWithSpriteFrameName("boat0016.png");
sp.setAnchorPoint(cc.p(0.5, 0.5));
sp.setPosition(new cc.Point(100,100));
console.log("x",sp.getPositionX());
console.log("y",sp.getPositionY());
console.log("wid",sp.getContentSize().width);
console.log("hei",sp.getContentSize().height);
console.log("visible?",sp.isVisible());
this.addChild(sp,1);
i'm getting x,y,width,height of this sprite but the sprite isn't visible.
I event hided all other elements to be sure it's not covered by another
graphics and I see only black screen. If I create the sprite using normal
PNG file it works.

No comments:

Post a Comment