Mario Posted April 27, 2017 Share Posted April 27, 2017 How can I set the color of a Phaser Line? var line = new Phaser.Line(0, 0, 100, 100); I did not find any info how to change the color from green to anything else. Official example:https://phaser.io/examples/v2/geometry/line Thx PS: Same problem with line width. Link to comment Share on other sites More sharing options...
samid737 Posted April 27, 2017 Share Posted April 27, 2017 You can use graphics to visualize your line: var line = new Phaser.Line(0, 0, 100, 100); var graphics=game.add.graphics(0,0); //var graphics=game.add.graphics(line.start.x,line.start.y);//if you have a static line graphics.lineStyle(10, 0xffd900, 1); graphics.moveTo(line.start.x,line.start.y);//moving position of graphic if you draw mulitple lines graphics.lineTo(line.end.x,line.end.y); graphics.endFill(); Link to comment Share on other sites More sharing options...
Mario Posted April 27, 2017 Author Share Posted April 27, 2017 That’s what I was looking for. Thank you! Link to comment Share on other sites More sharing options...
samme Posted April 27, 2017 Share Posted April 27, 2017 You can also try graphics .lineStyle(10, 0xff0000) .drawShape(line); samid737 1 Link to comment Share on other sites More sharing options...
samid737 Posted April 28, 2017 Share Posted April 28, 2017 @samme is right on the money about the drawShape. Its probably even more convenient since you can draw any shape (makes sense since its called drawShape) you like with one command. Link to comment Share on other sites More sharing options...
samme Posted April 28, 2017 Share Posted April 28, 2017 drawShape was weird before as it didn't actually understand any Phaser shapes but I think it works now. Link to comment Share on other sites More sharing options...
Mario Posted May 5, 2017 Author Share Posted May 5, 2017 Thx, @samme, I will try that too Link to comment Share on other sites More sharing options...
Recommended Posts