Jump to content

Group scale & body scale


Teflo
 Share

Recommended Posts

Hey there, great framework you made!

But I have one problem. When I scale a group, every sprite gets rescaled, but the bodies attached to them are not. So I tried to scale the bodies with body.updateBounds(); But that didn't change anything. So I took a look in the code and I see, the updateBounds() method doesn't take the group scale into account, but just the sprite scale, which isn't directly affected by group scale.

 

Now I tried to copy the updateBounds() method and edit it, so it uses the scale I want. It seems to be working at first, but somewhere the body size is resetted and I end up with same unscaled bodies.

 

 

How am I supposed to do it correctly?
And just because I'm curious: Is there a good way to let everything be normal and just render the whole thing with a scale?

 

Thanks!

Link to comment
Share on other sites

  • 1 year later...

for arcade you could do this maybe.. but it does seem like a bit of a workaround for something you'd expect to happen internally.

group.forEach(function(sprite) {      sprite.body.setSize(sprite.width * group.scale.x,  sprite.height * group.scale.y)})

although I have some odd collision behaviour here http://phaser.io/sandbox/XzaIExTz/play

 

(scale 2,2 worked ok though)

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...