Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

dynamic bitmapdata creation


pranadevil
 Share

Recommended Posts

hi i got a function that draws the character clothes like this.

 addBitmap: function()    {                               bmd = game.add.bitmapData(95,80);        nuevodiskette = game.add.sprite(0,0,'nnnn');        nuevodiskette.anchor.setTo(0.5, 0.5);                bmd.draw(nuevodiskette,0,0);        game.physics.arcade.enable(bmd);        bmd.addToWorld(100,100);    }
addS: function()    {                var s1 = this.s.getFirstDead();        if(!s1)        {         return;           }                s1.anchor.setTo(0.5, 0.5);        s1.reset(game.world.centerX, 500);        s1.body.gravity.y = 200;        s1.body.velocity.y = -250 ;        s1.body.velocity.x = 10 * Phaser.Math.sign(-1);        s1.body.bounce.x = 1;        s1.checkWorldBounds = true;        s1.outOfBoundsKill = true;        this.addBitmap();        s1.addChild(bmd);    }, 

when i use addChild to any group member, the game stucks and got this error:

!!!   Uncaught TypeError: a.setStageReference is not a function

 

 

 

 

got any idea why??

Link to comment
Share on other sites

  • 3 months later...

A BitmapData is not a display object. You cannot add it as a child or add it to the display list. Think of it as being like a dynamic texture. You must create a Sprite and assign the BitmapData as its texture.

And with this method, we can process a getPixel on this BitmapData ?

If yes, how can we access to these pixels ?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...