pranadevil Posted September 10, 2015 Share Posted September 10, 2015 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 More sharing options...
rich Posted September 10, 2015 Share Posted September 10, 2015 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. Tilde and jdnichollsc 2 Link to comment Share on other sites More sharing options...
JeanBambi Posted December 23, 2015 Share Posted December 23, 2015 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 More sharing options...
Recommended Posts