Elgan Posted May 29, 2014 Share Posted May 29, 2014 is it possible to get the sprite from a tile, and then animate, and destroy it? pseudo code{tileSprite = getTIleSprite() tileSprite.animate() map.removeTile(x: number, y: number, layer: any);} Link to comment Share on other sites More sharing options...
lewster32 Posted May 29, 2014 Share Posted May 29, 2014 A TileSprite is an extension of a Sprite, and can be animated in the same way as a normal Sprite. If you want to get a specific tile the Tilemap object has a few methods to do that. Link to comment Share on other sites More sharing options...
Elgan Posted May 29, 2014 Author Share Posted May 29, 2014 Yes, but with the tile returned from gettile()Can you then turn a tile object into a sprite? Link to comment Share on other sites More sharing options...
lewster32 Posted May 29, 2014 Share Posted May 29, 2014 Oh I see. I'm not sure you can turn a Tile object into a Sprite object directly (though it seems odd that you can't and I'm sure I saw somewhere that you can!) - you'd probably have to remove the tile and at the same time replace it with a sprite using the same image, and then animate it. Link to comment Share on other sites More sharing options...
lewster32 Posted May 29, 2014 Share Posted May 29, 2014 There is a createFromObjects method on TileMap but this replaces all tile matching a certain ID. Maybe looking at the code for that will give you an idea of how to convert a Tile into a Sprite, as that's what this function does within its loop. Link to comment Share on other sites More sharing options...
Recommended Posts