gRoberts Posted February 3, 2016 Share Posted February 3, 2016 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: 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. 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 More sharing options...
gRoberts Posted February 4, 2016 Author Share Posted February 4, 2016 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 More sharing options...
Recommended Posts