Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

If I scale a background, does it affect scaling of later sprites?


mwatt
 Share

Recommended Posts

Title pretty much says it all.

 

I'm struggling (still) with my home grown solution for scaling my game at different resolutions.  I don't want to go into the gory details, nor necessarily invite links to the similar (but different) solutions that other people have already been so kind as to post...

 

Right now I am seeing odd behavior in the emulator for iPhone 6.  It LOOKs like the scaling of a background image might be affecting the scaling of a subsequent image sprite placed atop said background.  It's hard to tell because my solution is straining my brain and it's a bitch testing in in xcode environment on an underpowered Mac.

Link to comment
Share on other sites

If you change the transform ( eg. with canvas.scale() ) everything you draw after this is effected until you restore a previous transform or change it further. Is that what you mean?

If so, take a look at https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Transformations

EDIT: Just to be clear the above makes the assumption you aren't letting Phaser do the scaling

Link to comment
Share on other sites

If you create a Sprite, and scale it, and then add children to that Sprite - those children will absolutely be impacted by the scale of their parent. It doesn't matter how high up the display list you go either, transforms flow down the chain, adjusting children as they go.

 

If all you've done is add a sprite for your background then some other sprites after it (i.e. not as children), then the scaling of the background will make no difference.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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