woratana Posted February 12, 2014 Share Posted February 12, 2014 Hello, I was stuck with this problem since yesterday. When I create tile sprite, it worked fine:this.ground = this.game.add.tileSprite(0, 750, 640, 206, 'ground');the position is X: 0, Y: 750. But when I tried to setRectangle to make it able to collide with other sprite, I added this code: this.ground = this.game.add.tileSprite(0, 750, 640, 206, 'ground');this.ground.body.immovable = true;this.ground.body.setRectangle(640, 206, 0, 0);The tile sprite somehow changed its position to the top of the screen. I have attach the image here. Please let me know if there is anything I need to know about positioning and making tile sprite collidable. Link to comment Share on other sites More sharing options...
AlexArroyoDuque Posted February 16, 2014 Share Posted February 16, 2014 Hi, I have the same problem. If I use setRectangle, my sprite is positioned at (0,0) You got to fix it? greetings Link to comment Share on other sites More sharing options...
AlexArroyoDuque Posted February 16, 2014 Share Posted February 16, 2014 My solution has been to define the position of the sprite after using setRectangle. this.game.add.sprite this.player = (200, 150, 'player'); this.player.body.setRectangle (75, 160, 0, 0); this.player.body.x = 200; this.player.body.y = 150; copycut 1 Link to comment Share on other sites More sharing options...
Recommended Posts