Wunderforce Posted February 5, 2018 Share Posted February 5, 2018 I am new to phaser and thought that arcade.collide() would separate overlapping sprites, but it doesn't. Is there a built in function for this or do I need to write my own? More detail: I am making a small game that randomly spawns apples at a certain y value and random x value across the game window. Sometimes they end up spawning such that they overlap each other. I was hoping that calling arcade.collide() on the group containing the apple sprites would separate them but it doesn't seem to work despite the call to arcade.collide(appleGroup) returning 'true'. Link to comment Share on other sites More sharing options...
samme Posted February 6, 2018 Share Posted February 6, 2018 If both objects are not moving there's no separation or acceleration after collide (https://gist.github.com/samme/cbb81dd19f564dcfe2232761e575063d). It's a little surprising. Link to comment Share on other sites More sharing options...
Wunderforce Posted February 6, 2018 Author Share Posted February 6, 2018 Yeah, I guess it sets the sprites to `embedded` in the internal `Phaser.Physics.Arcade.overlapX()` method if they are not moving. Good thing they included an option to pass a collisionHandler to `collide()` and `overlap()`. Link to comment Share on other sites More sharing options...
Recommended Posts