Pau 1 Report post Posted July 7, 2018 Hello! I would like to make geometry interactive. I have this code: var puerta1 = new Phaser.Geom.Rectangle(500, 100, 230, 430).setInteractive() var graphics = this.add.graphics({ fillStyle: { color: 0xff0000 } }); graphics.fillRectShape(puerta1); But the console is telling me that setInteractive is not a function. How can i make puerta1 object interactive? Thanks in advance Quote Share this post Link to post Share on other sites
samme 719 Report post Posted July 7, 2018 It must be done on the Graphics object, and I think you have to specify a hit area as well. Quote Share this post Link to post Share on other sites
Pau 1 Report post Posted July 7, 2018 Hello! I followed to advice and now the event triggers, but i happens when the mouse enter in the canvas var puerta1 = new Phaser.Geom.Rectangle(500, 100, 230, 430) var graphics1 = this.add.graphics({ fillStyle: { color: 0xff0000 } }); graphics1.fillRectShape(puerta1) graphics1.setInteractive(puerta1, puertaPulsada) ... function puertaPulsada(puerta){ alert("enter") } Quote Share this post Link to post Share on other sites
Pau 1 Report post Posted July 14, 2018 I founded, but i wanted to make a geometry interactive inside an sprite, and there is an special code for it: var mazmorra = juego.add.sprite(480, 320, 'mazmorra'); var puerta1 = juego.add.zone(150, 140, 210, 410) puerta1.setInteractive(); puerta1.on('pointerdown', puertaPulsada); Quote Share this post Link to post Share on other sites