Jump to content

TileSprite without repetition?


gRoberts
 Share

Recommended Posts

Hey all,

Working on a game that animates a number of different layers to produce an parallax effect however I'm stuck when trying to repeat a single instance of a tile across the world and once out of view, it comes back in, i.e. marquee effect.

The only ways I can think of doing this is:

  1. Create an asset with a lot of white space, however this could result in the tile taking longer on smaller devices and repeating on larger devices.
  2. Use a standard tile and change the X/Y values and use math to reset once out of view.

Is there any way we can tell the TileSprite to effectively not repeat, but still move the image along the path as usual?

Thanks

Link to comment
Share on other sites

FYI, I just ended up doing:

app.game.prototype.update = function() {
    sprite.x -= .3;
    if (sprite.x <= -sprite.width) {
        sprite.x = this.world.width;
    }
}

Which as soon as it was out of view, it reset the x position back to the other side and continued moving.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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