Having trouble creating a sprite from BitmapData? It seems that when working with a rectangular shape, everything runs smoothly. However, when dealing with just a line, the sprite ends up empty.
bmd = this.game.add.bitmapData(this.line.width, this.line.height);
//Creating a rectangle works fine:
bmd.ctx.rect(0, 0, 32, 32);
bmd.ctx.fillStyle = "#0f0";
bmd.ctx.fill();
var platform = this.game.add.sprite(this.line.midPoint().x, this.line.midPoint().y, bmd);
//Creating a line doesn't work
bmd.ctx.this.lineWidth = "8";
bmd.ctx.strokeStyle = 'white';
bmd.ctx.moveTo(this.startPoint.x, this.startPoint.y);
bmd.ctx.lineTo(this.endPoint.x, this.endPoint.y);
bmd.ctx.stroke();
var platform = this.game.add.sprite(this.line.midPoint().x, this.line.midPoint().y, bmd);
Any known issues or am I making a major mistake in my code?
Thank you for your time