MTiger Posted April 18, 2017 Share Posted April 18, 2017 (edited) I was working with a popular online tutorial in making an infinite runner game. All goes well, except there seems to be this one instance that pushed the player off the screen. (keeping player at velocity 0 instead of -platformSpeed). I think the issue is with this line this.player.body.velocity.x = this.player.body.touching.down ? -this.levelSpeed: 0; It seems to happen when the player catches the very corner of the platform, and isdown does not get set, then the player is "pushed" onto the platform. But this is just a logical guess as it happens too fast to debug. The collision check happens in a line above this.platformPool.forEachAlive(function (platform, index) { this.game.physics.arcade.collide(this.player, platform); if (platform.length && platform.children[platform.length - 1].right < 0) { platform.kill(); } }, this); My full code is here, but I can't figure a way to get the assets to load http://jsbin.com/tufisagoho/edit?html,js,output (updated link with Hosted Assets) Edited April 18, 2017 by MTiger updated link with Hosted Assets) Link to comment Share on other sites More sharing options...
MTiger Posted April 20, 2017 Author Share Posted April 20, 2017 It only happens like once out of twenty times. Do you think increasing the Tile_bais would help? Link to comment Share on other sites More sharing options...
MTiger Posted April 25, 2017 Author Share Posted April 25, 2017 up Link to comment Share on other sites More sharing options...
samid737 Posted April 27, 2017 Share Posted April 27, 2017 This won't give an answer to your problem, but when setting the player its body to a circle, you should not be able to reproduce your problem: this.player.body.setCircle(40,-15,-15); Maybe it will give you more insight in what might be the cause (I was not able to dig into the code). Maybe you could ask the developer who published the tutorial? Link to comment Share on other sites More sharing options...
Recommended Posts