Jump to content

Help with drawing lines using bitmapData object


JToaster
 Share

Recommended Posts

I'm trying to make it to where the user can draw lines on the screen, with a bitmapData object. When I try to draw on the screen, I get a 404 error, and I'm not sure why. Any help is appreciated! Here's my code:

var game= new Phaser.Game(720,1000,Phaser.CANVAS, 'game_div');var play={	preload: function()	{		this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;		this.game.scale.setShowAll();		game.scale.refresh();		this.game.load.image('nope','assets/wrong.png');	},	create: function()	{		this.bmd=this.game.add.bitmapData(720,1000);		this.ctx=this.bmd.context;		this.ctx.setLineWidth(5.0);		this.ctx.setFillColor(255,0,0,0);		this.game.add.sprite(0,0,this.bmd);		this.game.stage.backgroundColor='#ab54c1';		this.game.scale.forceOrientation(false, true, 'nope');	},	update: function()	{		if(this.game.input.activePointer.isDown)					{			this.ctx.lineTo(this.game.input.activePointer.x,this.game.input.activePointer.y);		}	}}game.state.add('play', play);game.state.start('play');
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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