Closed RafaelOliveira closed 10 years ago
Yes am facing the same problem too, physics.collide doesn't work properly (i post a more descriptive topic with examples here http://www.html5gamedevs.com/topic/2538-sprite-stop-moving-weirdly/)
Just ran into the same problem
Quick fix is (if you are using ArcadePhysics)
https://github.com/photonstorm/phaser/blob/master/src/physics/arcade/ArcadePhysics.js#L489
Change to:
if (object1.type == Phaser.SPRITE || object1.type == Phaser.TILESPRITE)
{
if (object2.type == Phaser.SPRITE || object2.type == Phaser.TILESPRITE)
{
My blind guess is that you can do this for all collisions using Sprite because in TileSprite constructor we can see:
Phaser.Sprite.call(this, game, x, y, key, frame);
While this will work I'd just like to add that the Sprites body will be set to the same size as the source image. I have however just pushed up a new 1.1.4 build which fixes it properly, to a degree (if you rotate or scale the tilesprite, the bounds don't update correctly yet).
Still doesnt collide with tile sprite (:
TileSprite and Sprite collision stopped working with Phaser 2.3.0 Arcade Physics. Still works with 2.2.2. Tried with the example on the website as well.
Already fixed in dev, please search gh issues for options.
In the version 2.3.0 it seems that TileSprite doesn't have the property physicsType
,so I think we can do that to fix it temporarily:
someTileSprite.physicsType = Phaser.SPRITE; //add this property manually
someGame.physics.arcade.collide(someSprite, someTileSprite); //and collide will now work
Still the same! I can't collide TileSprite and Sprite. I've try every tutorial that I found in the internet and still doesn't work. I'm using Phaser 2.4.4
Game.prototype.update = function () {
this.game.physics.arcade.collide(this._player, this._ground);
};
this._ground
is the TileSprite and this._player
is the Sprite. Does anyone know if it has fixed and the solution?
Thanks!
game.physics.collide don't work with TileSprites. The collide function don't have tilesprites in the valid objects.