Jump to content

Parents, Childs and "Scale.To"


Recommended Posts

I have a "parent sprite" and created a "child sprite".

I scaled my parent down, because i want it to look fine when somebody have a higher resolution and scale the game "up".


Example code:

var exampleParent = this.add.sprite(this.world.centerX, this.world.centerY-400, "parent");

exampleParent.scale.setTo (0.5, 0.5);

var exampleChild = exampleParent.addChild(this.make.sprite(-100, -40, "child")); 


I get a really strange behaviour now. The "child sprite" isnt really scaled down. When i do a "overlap-test", or check the "sprite.width" in the console, its has its original size.


But the "Childsprite" is displayed by thehalf of its size...


Thats really weird, any tips what i can do to display it at its correct size?





Link to comment
Share on other sites


  • Recently Browsing   0 members

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