jorgepynho Posted January 30, 2017 Share Posted January 30, 2017 Hi there! OK, so I just figured out how to draw shapes with the graphics object. But, I wonder why this method exist ?!?! line = new Phaser.Line(100, 100, 200, 200); ... and then it gets positioned on update() But a line, never gets rendered Does this mean that, this method "Phaser.Line()" is useless ?!?!?! Link to comment Share on other sites More sharing options...
mcolman Posted January 30, 2017 Share Posted January 30, 2017 When you look at the docs, everything under 'Geometry' are just plain javascript objects with properties to describe shapes and helper methods. If you just want to draw a line to the canvas, then Phaser.Line is not what you're looking for. Just use the Graphics object like so: const g = this.game.add.graphics(0, 0) g.beginFill(0xff0000) g.moveTo(100, 100) g.lineTo(200, 200) Phaser.Line is not useless, look at the docs to see what it can be useful for http://phaser.io/docs/2.6.0/Phaser.Line.html Link to comment Share on other sites More sharing options...
jorgepynho Posted January 30, 2017 Author Share Posted January 30, 2017 Thanks Matt I meant "useless" just for fun... Of course it is not But in fact... I would use something like: line = new Phaser.Line(100, 100, 200, 200); const g = this.game.add.graphics(0, 0) g.beginFill(0xff0000) g.moveTo(line.x, line.y) etc ... However, it is intuitive to expect something like this in a HTML5 canvas framework (like others have) line = new Phaser.Line(100, 100, 200, 200); line.draw_or_whatever({properties}) Anyway... I am going to create my own methods for this. Link to comment Share on other sites More sharing options...
Recommended Posts