Jump to content

More problems 1.1.3 to1.1.4, sprites position


Recommended Posts


I am having several problems upgrading from version 1.1.3 to 1.1.4. Now I am not able to position some of my sprites in the game when they are created. They always seem to appear at position (0, 0). 


However, I have a group of sprites that are positioned correctly and I do not understand why. 


Here's the code from one of my sprites: 


  this.load.spritesheet ('player', 'assets / character / player-sprite.png', 120, 180); 



             this.player = this.game.add.sprite(200, 400, 'player');

             this.player.body.gravity.y = 160; 

             this.player.body.setRectangle (75, 160, 0, 0); 

             this.player.anchor.setTo (0.5, 0.5); 


As I said, I'm having difficulties in changing version. I'm blocked. Any help would be great. 



Link to comment
Share on other sites

My solution has been to define the position of the sprite after using setRectangle. 


             this.game.add.sprite this.player = (200, 150, 'player'); 

             this.player.body.setRectangle (75, 160, 0, 0); 

             this.player.body.x = 200; 

             this.player.body.y = 150;

Link to comment
Share on other sites

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.

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.


  • Recently Browsing   0 members

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