Jump to content

Increasing X coordinate while adding sprite moves it left not right. why?


terencechow
 Share

Recommended Posts

I'm doing a Phaser project for work and I've adopted the current code base.

I have a bit of an odd situation.

The game width is 1024 by 748. The world bounds are set by

game.world.setBounds(-1024,0,3072,748)

When adding sprites, the code base I've adopted has

game.add.sprite(2424,0,'name of atlas','name of png')

Based on this it appears the previous developer was creating these sprites off screen.

When I adopted this it was using Phaser 2.1. I upgraded to Phaser 2.2.1 because it had an Internet Explorer Fix I needed.

Now however, half the time the sprites will be created on the screen and the other half of the time the sprites are created off screen.

What was changed between the versions to create this type of issue?

Also note that, if I add a sprite with x coordinate is between 0 and 1024, I indeed see this sprite moving from the left to the right of the screen.

From 1024 to roughly 2200 I don't see the sprite at all.

However adding the sprite with an x coordinate from 2200 to roughly 2800 has the odd effect of starting at the far right of the screen and moving left. That means, when I use 2200 the sprite is at the edge of my 1024 game screen. When I use 2800 it is at the edge of my left game screen.

This is counter intuitive to me because as X goes up the sprite should move farther away from the left.

Anyone know why or what is happening here?

 

 

Link to comment
Share on other sites

Unless this is a known issue already (or can be quickly discerned by Phaser devs), we will probably need an example of this behaviour in code.

 

Can you make a minimal test case that will demonstrate this problem? Alternatively, show us your current code.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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