Hi,
I’d like to make a class that extends cc.Sprite. Right now, I’m trying to do it as follows:
var ExtendedSprite = cc.Sprite.extend(
{
ctor:function () {
this._super();
},
});
Then I have another class, “Ball,” meant to extend ExtendedSprite:
var Ball = ExtendedSprite.extend(
{
ctor:function()
{
this.initWithSpriteFrameName("ball_1.png");
},
});
I’m then trying to create a new instance of Ball as follows:
this._ball = new Ball();
The app always crashes on the new Ball() line without giving me any further information. If I make Ball extend cc.Sprite, it works fine, so I’m clearly doing something wrong when I try to extend it with ExtendedSprite. Does anyone have any pointers for how to do this properly? Any advice is greatly appreciated!