Jump to content

Issue using mouse events


Recommended Posts

So, I'm having trouble understanding how to do something when clicking on a specific object. I'm creating game objects with this function:

        this.newBurger = new Burger(this,this.input.mousePointer.x+cam.scrollx,this.input.mousePointer.y,'11');
        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?

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...