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

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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