bluedot

How to draw a partial circle ?

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.