Jump to content

bitmapData bmd.draw from atlas is offset for some reason


ptotheaul
 Share

Recommended Posts

I'm using bitmapData to capture a frame from a sprite with an atlas animation.  Every thing work fine except the location of the draw is offset for the location of the original.  I am scaling the original sprite but the image that is dawn is perfect except for a seemly random  155 x and 65 y offset.  I can't figure out where the offset value is coming from. Can anyone see a reason this is happening?

 

var bmd = this.game.make.bitmapData(this.Badguy.x + this.Badguy.width, this.Badguy.y + this.Badguy.height);

//seems like this should should put bmd directly on top of sprite

bmd.draw(this.Badguy,  this.Badguy.x, this.Badguy.y);

//but have to off set by 155  and 65 for it to match up.

//bmd.draw(this.kaiju,  this.kaiju.x + 155, this.kaiju.y + 65);

bmd.update();

bmd.addToWorld();

 

/////////  This is how the Badguy sprite/animation is set up

this.Badguy= this.game.add.sprite(-800, 180, 'badguywalk', '01.png');

this.Badguy.scale.set(2,2);

this.Badguy.animations.add('walk', Phaser.Animation.generateFrameNames('', 1, 48, '.png', 2), 15, true, false);

this.Badguy.animations.play('walk');

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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