moe091 Posted February 25, 2014 Share Posted February 25, 2014 Is there any way to decrease the size of the bounding box used for collisions in phaser? Right now I am just implementing my own collision inside phasers callback, essentially using phasers collision as a (slightly)-broad phase collision detection but it'd be cleaner and more efficient if I could just scale the collision box somehow without scaling the actual sprite. Honestly I'm not sure which version of phaser I'm currently using, I downloaded it about a month and a half ago and didn't even pay much attention to it because I didn't expect to make any serious games yet. my current project was just too much fun and I blew it up into a big game(by html5 mobile game standards). Anyway, thanks for any help. And thanks to Rich and everyone who worked on Phaser, it's awesome to work with! Link to comment Share on other sites More sharing options...
lessmilk Posted February 25, 2014 Share Posted February 25, 2014 Yes, you can change the collision box like this: sprite.body.setSize(width, height, x, y); Link to comment Share on other sites More sharing options...
psyconiak Posted August 14, 2015 Share Posted August 14, 2015 there are so many guys replying to those questions with "sprite.body.setSize(width, height, x, y);" but its so bugged. if you set a different anchor for your sprite, the thing flies all over the screen into some corner and i cant seem to find a way around it Edit:i found the solution. you have to reset the players position after changing the size: player.body.reset(player.x, player.y); Link to comment Share on other sites More sharing options...
Recommended Posts