julacariote Posted May 16, 2014 Share Posted May 16, 2014 Hi everyone, I ran into a problem while prototyping a game. The game is very basic for now: the player is a 32x32 square sprite in a tilemap of 32x32 tiles. The player had to dig trough the dirt tile. Grey tiles (rocks) will fall down if there is no more dirt below them. As you can see on the screenshots, if the player remove a dirt tile below a rock, this one will start falling down and will also make the player tunneling through the dirt tiles which of course is not intended. I don't understand where the problem might be? In update, I make the player collide with rocks and the dirt tiles. update: function() { // ... this.game.physics.arcade.collide(this.player, this.layerDirt); this.game.physics.arcade.collide(this.rocks, this.layerDirt); this.game.physics.arcade.collide(this.player, this.rocks); //... }I also checked the tiles collisions attributes: collideUp is set to true for the tiles below the player. The player body is set to collide on every faces. Also, the group "rocks" has its property "allowGravity" set to false. It's only when the player remove a dirt tile below a rock that I set the allowGravity of this rock to true. But this is done all in the same frame. Creating the rocks group:create: function() { //... this.rocks = this.game.add.group(); this.rocks.enableBody = true; this.map.createFromObjects('rocks', 7, 'rock', 0, true, false, this.rocks); this.rocks.setAll('body.allowGravity', false); this.rocks.setAll('body.immovable', true); // I don't want the player to be able to push rocks //...}It seems that the falling rock gives a velocity to the player which is correct but the player should immediately collide with the dirt tile below him? I tried to play with the TILE_BIAS attribute but still no luck from 40 to 150. The value of gravity does not change anything, the problem is still here with a gravity of 10 or 300. Can anyone help me in the right direction?Thanks! Link to comment Share on other sites More sharing options...
msqar Posted February 10, 2018 Share Posted February 10, 2018 Holy... seems no one knows how to fix this issue... 2018 and still happening :S it happens with me when my sprite arcade physic character falls from a long distance, let's say 843 px high. Any solution for this, guys? Link to comment Share on other sites More sharing options...
Recommended Posts