TMichel Posted August 18, 2014 Share Posted August 18, 2014 Hi, I just started testing Phaser and i am trying to render a simple polygon on screen:var g = new Phaser.Graphics(game);var p = new Phaser.Polygon(10,10,70,70,70,10,10,10);g.drawPolygon( p );Using v2.0.6. Am i missing something? Link to comment Share on other sites More sharing options...
ZoomBox Posted August 19, 2014 Share Posted August 19, 2014 I believe you have to fill it with a color.This should be something like p.fill(#FF55FF); But I'm not sure. Edit: For future reader: I was totally wrong. Link to comment Share on other sites More sharing options...
TMichel Posted August 19, 2014 Author Share Posted August 19, 2014 Thank you. Polygon does not have fill() method but as stated in the Graphics doc, drawPolygon() "Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled". Graphics object does not seem to provide that neither. Anyway my intention is not even fill it or show it, i will use it only for debuging purposes, as i want to use its points to replicate the behaviour on the chained tweens example. I usually do this in Turbulenz by enabling the 2DDebug viewport. Apparently in Phaser i must use game.debug.geom() for that purpose but i see that only accepts basic shapes and lines as a parameter, am i right? Link to comment Share on other sites More sharing options...
lewster32 Posted August 19, 2014 Share Posted August 19, 2014 Phaser.Polygon is an abstract object meant to represent collision areas and so on - it's not a graphics object as such. To draw polygons on a Graphics object you should see this example, as Phaser.Graphics is an extension of pixi's Graphics object: http://www.goodboydigital.com/pixijs/examples/13/ peer2p 1 Link to comment Share on other sites More sharing options...
Recommended Posts