SkyzohKey Posted February 5, 2015 Share Posted February 5, 2015 Hello ! How am I supposed to set the anchor point for a game.Graphics object ? Here's my code : this.sprite = new game.Graphics();this.sprite.beginFill(this.border);this.sprite.drawRect(0, 0, this.size.width, this.size.height);this.sprite.beginFill(this.background);this.sprite.drawRect(0 + this.borderSize, 0 + this.borderSize, this.size.width - this.borderSize * 2, this.size.height - this.borderSize * 2);this.sprite.position.set(this.position.x, this.position.y);// this.sprite.anchor.set(0.5, 0.5) is not working :/Thanks a lot for your futures answer ! EDIT : SOLVED MY PROBLEM BY DOING THIS :this.sprite.drawRect((-this.size.width / 2), (-this.size.height / 2), this.size.width, this.size.height);this.sprite.position.set(this.position.x - (-this.size.width / 2), this.position.y - (-this.size.height / 2));Thanks to enpu to make me in the right way ^^ Quote Link to comment Share on other sites More sharing options...
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.