dsas Posted May 21, 2019 Share Posted May 21, 2019 Hello everyone! I hope you are having an excellent day to help me out ? Long story short, I'm trying to toggle a boolean when something overlaps and most important, when it stops overlapping. I created the example below to get which is the parameter that changes when an overlap occurs: this.w1 = this.physics.add.sprite( 100, 100, 'atlas-minions', `blue/walk/minion_00.png` ).setInteractive( { draggable: true } ); this.w2 = this.physics.add.sprite( 400, 100, 'atlas-minions', `red/walk/minion_00.png` ).setInteractive( { draggable: true } ); this.w3 = this.physics.add.sprite( 800, 100, 'atlas-minions', `red/walk/minion_00.png` ).setInteractive( { draggable: true } ); this.groupa = this.add.group(); this.groupa.add( this.w2 ); this.groupa.add( this.w3 ); console.log( 'w1 BEFORE', this.w1.body.touching ) this.physics.add.overlap( this.w1, this.groupa, () => { console.log( this.w1.body.touching ) }, null, this ); But when I drag w1 over w2 or w3, the console.log prints the same result as when w1 is created: down: false left: false none: true right: false up: false How come this.w1.body.touching.none = true even when is actually touching something?? ლ(ಠ_ಠლ) Is some other parameter that registers the overlapping? Also I saw another solution here, but it only works with single objects. In my game I needed this to work with groups instead. I know I could convert the code but it looks like a workaround too big for something this simple. After many hours looking everywhere for an answer, I just ended up burnt. Please send help ಥ_ಥ Link to comment Share on other sites More sharing options...
Recommended Posts