# How to add right click functionality to object?

**URL:** <https://phaser.discourse.group/t/how-to-add-right-click-functionality-to-object/1731>\
**Category:** Phaser 3\
**Created:** [March 18, 2019, 9:16pm UTC](https://phaser.discourse.group/t/how-to-add-right-click-functionality-to-object/1731 "2019-03-18T21:16:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vendicious](https://avatars.discourse-cdn.com/v4/letter/v/4491bb/32.png) [@vendicious](https://phaser.discourse.group/u/vendicious)\
**Post date:** [March 18, 2019, 9:16pm UTC](https://phaser.discourse.group/t/how-to-add-right-click-functionality-to-object/1731/1 "2019-03-18T21:16:42Z")

</div>

Hey There,

trying to figure out how to detect right click. any help would be greatly appreciated. i have an object function running this:

```
this.setInteractive({useHandCursor: true })
  .on('pointerover', () => 
    {
        debugtext.x = Math.ceil(game.input.mousePointer.x/64)*64;
        debugtext.y = Math.ceil(game.input.mousePointer.y/64)*64-64;
        if (this.mined < 8) {
            debugtext.setText(`id: ${this.tID} \nin: ${this.mined}`);
        }
        else{
            debugtext.setText(`id: ${this.tID} \nin: full`);
        }
    })
    .on('pointerdown', () => 
    {
        if (this.mined < 8) {
            this.mined++;
            console.log("ID: ", this.tID, "mined: ",this.mined);
            debugtext.setText(`id: ${this.tID} \nin: ${this.mined}`);
        }
        else{
            debugtext.setText(`id: ${this.tID} \nin: full`);
        } 
        
    })
    .on('rightButtondown',() =>
    {
        console.log('rightclick');
    });
```

---

<div class="post-metadata">

**Author:** ![hcakar](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/hcakar/32/459_2.png) [@hcakar](https://phaser.discourse.group/u/hcakar)\
**Post date:** [March 19, 2019, 6:41am UTC](https://phaser.discourse.group/t/how-to-add-right-click-functionality-to-object/1731/2 "2019-03-19T06:41:58Z")

</div>

Hey first of all welcome and i saw that there is an example on [labs.phaser.io - input\mouse](https://labs.phaser.io/edit.html?src=src%5Cinput%5Cmouse%5Cright%20mouse%20button.js) maybe you would like to check that 🙂

---

<div class="post-metadata">

**Author:** ![vendicious](https://avatars.discourse-cdn.com/v4/letter/v/4491bb/32.png) [@vendicious](https://phaser.discourse.group/u/vendicious)\
**Post date:** [March 26, 2019, 9:26am UTC](https://phaser.discourse.group/t/how-to-add-right-click-functionality-to-object/1731/3 "2019-03-26T09:26:01Z")

</div>

thanks! will give it a try.
