driver.by Posted February 3, 2014 Share Posted February 3, 2014 Hello, I need some help.I want to draw something on BitmapData and add it to the stage. I've tryed this code (it's "create" function of my state):this.backBMD = this.game.add.bitmapData(this.game.width, this.game.height);this.backBMD.strokeStyle('#fff');this.backBMD.beginPath(); this.backBMD.moveTo(0, 0);this.backBMD.lineTo(100, 100);this.backBMD.add(new Phaser.Sprite(this.game, 50, 50, 'ball_blue'));this.game.add.sprite(50, 50, this.backBMD);I draw a line and add sprite to my bitmapData. Then I add it as a sprite and see nothing on my canvas. However, this code is working fine:this.game.add.sprite(50, 50, 'ball_blue'); Is it correct approach, or I've made some mistake?Thanks, in advance. Link to comment Share on other sites More sharing options...
rich Posted February 3, 2014 Share Posted February 3, 2014 The way you are doing it is just fine, but you don't stroke or fill your line, which is why nothing appears. Link to comment Share on other sites More sharing options...
driver.by Posted February 3, 2014 Author Share Posted February 3, 2014 So stupid mistake.Thank you, rich. Link to comment Share on other sites More sharing options...
Recommended Posts