0
\$\begingroup\$

im trying to make a circle button with tap event i used hitArea property from sprite class and using pixi Circle class i did that

this.sprite = game.add.sprite(50,50,"cursors");

        this.sprite.anchor.set(0.5,0.5);

        this.sprite.hitArea = new PIXI.Circle(50,50,84);

        this.sprite.inputEnabled = true;

        this.sprite.events.onInputDown.add(function(){

            console.log("clicked");
        });

    };

it is not working at all so i tried removing this.sprite.anchor.set(0.5,0.5);

input is work fine when there is no hit Area so what should i do

note : phaser version is 2.2.2

\$\endgroup\$
  • 1
    \$\begingroup\$ Use phaser.Circle instead of PIXI.Circle and see if it works, as i know phaser uses pixi as renderer but all namespaces do not begin with PIXI. As you will see if you use PIXI sepertatly \$\endgroup\$ – Pooya Estakhri Mar 14 '15 at 13:02
  • \$\begingroup\$ it is not working too \$\endgroup\$ – Sky Walker Mar 14 '15 at 13:56
  • 1
    \$\begingroup\$ this is an example of drawing a Circle in Phaser Examples phaser.io/examples/v2/display/circle \$\endgroup\$ – Pooya Estakhri Mar 14 '15 at 14:40
  • 1
    \$\begingroup\$ this may help you phaser.io/examples/v2/debug/debug-draw \$\endgroup\$ – Pooya Estakhri Apr 2 '15 at 9:58

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.