Lotti Posted March 2, 2014 Share Posted March 2, 2014 Hello! It's my first time with phaser and i'm pretty excited about it. I'm making a very simple game just to see how I feel working with a library for html5 (I work with unity3d everyday). I made 32x32 sprites and then I scaled them to different sizes: 0.3x0.3 and 0.5x0.5, I setted a circle collider, then i rendered the colliders with game.debug.renderPhysicsBody on "render loop" and I noticed that the colliders are not centered with the sprites! It does occurs only with scaled sprites.here it is my code circle = game.add.sprite(100, 100, 'circle'); circle.name = 'circle'; circle.scale.setTo(0.3,0.3); circle.body.setCircle(circle.width/2); circle.body.bounce.y = 0.2; circle.body.gravity.y = 200; circle.body.collideWorldBounds = true; I don't know if this behaviour is expect or it is a bug. If it is expect, how can i center the collider with the sprite? Thank you. Link to comment Share on other sites More sharing options...
valueerror Posted March 2, 2014 Share Posted March 2, 2014 Hmmmm.. This code should not work at all in 1.2 (I guess you're in the wrong subforum)I'd try to set the anchor to 0.5,0.5. ( done automatically in 1.2 afaik)You also could define an offset for the circlesetCircle(radius,offsetx,offsety) Link to comment Share on other sites More sharing options...
Lotti Posted March 3, 2014 Author Share Posted March 3, 2014 yes you're right i never switched the branch to 1.2 when started the game :\ However this bug affects only the previous release, not the 1.2. sorry Link to comment Share on other sites More sharing options...
Recommended Posts