Oliver77 Posted June 15, 2022 Share Posted June 15, 2022 Hi I, use this for dragable objects: this.physics.add.overlap(rec, puzzleGroup, overlap,null,this); I have the problem that it is firing continuously. What do I have to do to make it firing just once so a variable is set true if the Element is over the sprite and if it’s not above the sprite the variable set to false. Thanks for feedback! Link to comment Share on other sites More sharing options...
Oliver77 Posted June 19, 2022 Author Share Posted June 19, 2022 Hi for my purpose I don't have to use physics. Instead I use this: in rec are my rectangles stored. this.input.on('dragend', function (pointer, gameObject) { for(i=0;i<rec.length;i++) { var boundsA = gameObject.getBounds(); var boundsB = rec[i].getBounds(); if(Phaser.Geom.Intersects.RectangleToRectangle(boundsA, boundsB) ){ console.log("it's over retangle: "+rec[i].x + " it's over gameObjekt: "+ gameObject.x) } else { console.log("its out") } } }); Link to comment Share on other sites More sharing options...
Recommended Posts