Easeljs Spielprojekt

Ich arbeite an einem Spielprojekt, habe aber ein Problem. Ich habe diesen Fehler erhalten:

NS_ERROR_NOT_AVAILABLE:

ctx.drawImage(this.image, 0, 0); //Bitmap.js in Easeljs lib.

Ich habe die Bitmap in den nächsten Codes verwendet. Bitte sagen Sie mir, ob hier ein Problem vorliegt und wie es behoben werden kann. Vielen Dank für die Zusammenarbeit.

Code 1:

p.initialize = function(x,y ,stage, world){
    var bmp = new Bitmap('../assets/blackBall.png'); 
    //console.log(bmp)
    //alert(bmp)
    bmp.regX = radius;
    bmp.regY = radius;
    bmp.x=x;
    bmp.y=y;
    this.skin = bmp;

    stage.addChild(bmp);

    var fixDef = new b2FixtureDef();
    fixDef.density = 1.0;
    fixDef.friction = 0.5;
    fixDef.restitution = 0.8;
    fixDef.shape = new b2CircleShape(38*CONST.pixelToMeter);

    var bodyDef = new b2BodyDef();

    bodyDef.type = b2Body.b2_dynamicBody;
    bodyDef.position.x = bmp.x*CONST.pixelToMeter; 
    bodyDef.position.y = bmp.y*CONST.pixelToMeter;

    this.body = world.CreateBody(bodyDef);
    this.body.CreateFixture(fixDef);
    this.skin.body = this.body;
    setUserData(this.body);
    /*Event handler*/
    this.skin.onMouseOver = handleMouseOver;
    this.skin.onMouseOut = handleMouseOut;
    this.skin.onPress = handleMouseDown;
    //console.log(this.skin);
}

Code 2:

p.initialize = function(stage, world){
    var shooterSkin = new Container();
    var cirlceSkin = new createjs.Bitmap('../assets/shooter.png');
    cirlceSkin.name = "ball";
    var arrowSkin  = new createjs.Bitmap('../assets/arrow.png');
    arrowSkin.name = "arrow";
    arrowSkin.rotation = 0;
    arrowSkin.scaleX =0;
    arrowSkin.regY = arrowHeight;
    cirlceSkin.regX = skinRadius;
    cirlceSkin.regY = skinRadius;
    cirlceSkin.x =0;
    cirlceSkin.y = 0;
    cirlceSkin.alpha=circleAlpha;
    shooterSkin.x=110
    shooterSkin.y = 110;
    shooterSkin.addChild(cirlceSkin);
    shooterSkin.addChild(arrowSkin); 
    arrowIndex = 1;

    this.skin = shooterSkin;
    stage.addChild(shooterSkin);

    var fixDef = new b2FixtureDef();
    fixDef.friction = 0;
    fixDef.restitution = 0;
    fixDef.isSensor = true;
    fixDef.shape = new b2CircleShape(radius*CONST.pixelToMeter);

    var bodyDef = new b2BodyDef();
    bodyDef.type = b2Body.b2_kineticBody;
    bodyDef.position.x = shooterSkin.x*CONST.pixelToMeter; 
    bodyDef.position.y = shooterSkin.y*CONST.pixelToMeter;
    this.body = world.CreateBody(bodyDef);
    this.body.CreateFixture(fixDef);
    setUserData(this.body);

Antworten auf die Frage(0)

Ihre Antwort auf die Frage