Pau Posted August 21, 2018 Report Share Posted August 21, 2018 Hello, I would like to create a interactive zone which is relative to an existing sprite. For example, this code is working: var marcoObjs = this.add.sprite(x, y, 'marcoObjs'); var puerta1 = this.add.zone(50, 50, 100, 100) puerta1.setInteractive(); this.add.graphics().lineStyle(2, 0xff0000).strokeRectShape(puerta1); But i want the puerta1 object to be relative positioned to marcoObjs object. So if marcoObjs x,y coordinates change, puerta1 coordinates must change too. I tried this way, but is not working: var marcoObjs = this.add.sprite(x, y, 'marcoObjs'); var puerta1 = marcoObjs.add.zone(50, 50, 100, 100) puerta1.setInteractive(); this.add.graphics().lineStyle(2, 0xff0000).strokeRectShape(puerta1); Any Ideas? Thank you in advance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.