tester Posted February 26, 2015 Share Posted February 26, 2015 Hi,I want to draw a verical line that is static. I assue that I need phaser.line ? http://docs.phaser.io/Phaser.Line.html So I have created a line object: line1 = new Phaser.Line(100,100,300,300); How do I however render it to screen ? thanks. Link to comment Share on other sites More sharing options...
tester Posted February 27, 2015 Author Share Posted February 27, 2015 Wondering if anyone can assist ? Thanks? Link to comment Share on other sites More sharing options...
JakeCake Posted February 27, 2015 Share Posted February 27, 2015 Is this specific to Phaser 3, or did you mean to post it in the main phaser forums? To draw a line with good performance and options such as color, line-width etc. use the graphics object "var gfx = game.add.graphics(x, y);" use "gfx.moveTo(x, y);", where x, y is the start of the line then use "gfx.lineTo(x, y);" where x, y is the end coordinates Look in the docs for graphics to see which other options you can set. It works like a state-machine which may be a bit confusing, but it does work, and performance is great in phaser as I believe it even utilises webgl. Link to comment Share on other sites More sharing options...
Recommended Posts