Jump to content

How to draw a partial circle ?


bluedot
 Share

Recommended Posts

The Phaser.Graphics object extends PIXI.Graphics, so it contains the same methods. You need arcTo, not arc. This is a bit confusing because the docs aren't updated, but the source is available here so you can determine the correct methods and signatures: https://github.com/GoodBoyDigital/pixi.js/blob/master/src/pixi/primitives/Graphics.js

Link to comment
Share on other sites

calling,  this.clockArc = new Phaser.Graphics.arcTo(800, 50, 850, 80, 20);

 

doesn't work. The JS console tells me that Phaser.Graphics is ok, but there's no arcTo(). Also, surely if Phaser.Graphics extends PIXI.Graphics it should also have PIXI.Graphics.arc() ?

I'm using phaser.min.js if that makes any difference.

 

Sorry, I'm pretty new at this JavaScript programming, you may have to go slow at explaining things to me.

Link to comment
Share on other sites

Your syntax is wrong - you need to create a Graphics instance first - see this example:

 

http://examples.phaser.io/_site/view_full.html?d=display&f=graphics.js&t=graphics

 

Essentially, game.add.graphics(x, y) is a factory method that conveniently creates a new Graphics instance. You can make the instance yourself with new Phaser.Graphics(game, x, y) too if you wish. Think of the Graphics instance as a canvas with which to draw on. You can then use arcTo and other methods on this instance to draw shapes on it.

 

Using a minified copy of Phaser should not make any difference so long as the version number is correct.

Link to comment
Share on other sites

  • 10 months later...
 Share

  • Recently Browsing   0 members

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