ylluminarious Posted August 2, 2014 Share Posted August 2, 2014 I need to load a TileSprite object in my game, but thus far I've used the `atlas` loader to load sprites in my game. I would like to keep things consistent and use the `atlas` loader, as opposed to the traditional `tileSprite` loader, but I'm not sure if this is possible. If so, how do you load a TileSprite object with the `atlas` loader? Link to comment Share on other sites More sharing options...
lewster32 Posted August 2, 2014 Share Posted August 2, 2014 You don't really 'load' a TileSprite any more than you load a Sprite, a TileSprite is the application of a loaded image, spritesheet or texture atlas to a specific purpose; in this case TileSprite takes that frame and repeatedly tiles it over the size you set, and lets you pan it in the X and Y directions as you want. It's important to make the distinction between the assets you load and the containers you create to show them on the screen as they are separate things in Phaser. One thing to be aware of is that TileSprites are sometimes awkward to get working if using a frame from a spritesheet or atlas on webGL, and may end up showing just the whole image rather than the frame you specified. If you find this happening, you may need to remove that image from the sprite sheet/atlas and load it separately. Once you know all this, to actually set a frame as the texture for a TileSprite all you do is pass the key of the atlas and then the frame name. See this example: http://examples.phaser.io/_site/view_full.html?d=tile%20sprites&f=tiling+sprite+atlas.js&t=tiling%20sprite%20atlas Link to comment Share on other sites More sharing options...
Recommended Posts