Jump to content

Draw a vertical line


Recommended Posts

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


  • Recently Browsing   0 members

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