penrose.in.space 0 Posted June 13, 2020 Report Share Posted June 13, 2020 So, I'm having trouble understanding how to do something when clicking on a specific object. I'm creating game objects with this function: createBurger(){ this.newBurger = new Burger(this,this.input.mousePointer.x+cam.scrollx,this.input.mousePointer.y,'11'); this.newBurger.setScale(1.2); cant_burgers++; ctnr_burgers.push(this.newBurger); this.newBurger.setInteractive(); this.newBurger.setData({sideA: 1, sideB: 1, cooked:0, flip: 0, celda: undefined}); this.input.on("pointermove", this.follow, this); this.input.on("pointerup", this.drop, this); this.input.on("drag", this.drag, this); F_burgerPicked = 1; } When the pointer is up, I want to add data to the specific object that's being clicked, not the last one created. I tried adding another event listener in the update function, to no avail. Is there a better way of doing this? Quote Link to post Share on other sites
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.