Search the Community
Showing results for tags 'phaserpositioning'.
-
Hey First of all mad props whoever created this beautiful piece of software! Here, is my questions regarding addChild method. From my AS3 days I remember child display object's coordinates were relative to parent. So, in this vein I was hoping gray square would be sitting in the top left corner of the blue square. Instead of this I got strange positioning, also child object(gray one) lost his propositions. Upon loading it was 100/100 square. I guess I am missing crucial line of code but I cannot figure out where am I messing up preload() { this.game.load.image("debugRect", "Scripts/assets/debugRect.png"); //Load Map TIles this.game.load.image("bigOrange", "Scripts/assets/secondMap/Untitled-3-0.png"); this.game.load.image("gray", "Scripts/assets/secondMap/Untitled-3-1.png"); this.game.load.image("lightBlue", "Scripts/assets/secondMap/Untitled-3-2.png"); this.game.load.image("red", "Scripts/assets/secondMap/Untitled-3-3.png"); this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; ; } create() { const introSquareSprite = this.game.add.sprite(10,10, "debugRect"); introSquareSprite.anchor.setTo(0, 0); introSquareSprite.width = 960; introSquareSprite.height = 650; const gray = this.game.add.sprite(0, 0, "gray"); gray.anchor.setTo(0, 0); introSquareSprite.addChild(gray); }and here is screenshot