I’ve got some code that works from one tutorial:
var tilesBitmapData:BitmapData = Assets.getBitmapData("img/tiles.png");
tilesheetCanvas = new Sprite();
tilesheet = new Tilesheet(tilesBitmapData);
Then some code that doesnt work from the “Fast 2D rendering using Tilesheets” tutorial:
var tilesheet:Tilesheet = new Tilesheet(Assets.getBitmapData(“img/tiles.png”));
I’m wondering what exactly these things do, what is a tilesheet and what exactly am I doing with them, what am I adding a child to? A bit of a generic question though I’m really lost on what all of this does.
Also my main question was how would I go about putting another image into the tilesheet from which I can draw from?
Look at the sample code from OpenFl. The display objects(sprite) need to be added to the stage to be drawn.
Tilesheet dont work that way, you need to manually call the draw function and pass the info (id of the rectangle,posición, rotación,etc) in an array.
Tilesheet is an avance feature and more complex to handle than just using display objects.
First get use to the display objects, they are way less restrictive than tilesheet and they are less tricky to start with.
You should consider using Tilemap, see how it works in the bunnymark example.
Also read the info about Tilemap here: http://www.openfl.org/blog/2015/10/06/october-update/
I use texturepacker, there is a OpenFL importer.
a great free texture packer is http://renderhjs.net/shoebox/
If you have no idea what a tilesheet or spritesheet is, search on the web
Raising a quick curiosity. I am familiar with spritesheets and the spritesheet lib and the tile sheet/map look of interest to me. Does anyone know how they perform / operate differently? Are there cases where tile sheets are better than sprite sheets, etc? Is spritesheet just intended for animation while tilemap is intended to be an atlas? Or do they operate differently under the hood / one is more efficient?
In general main focus of tilemaps and spritesheets is to have diferent images loaded into a single texture into the GPU, so you can draw stuff more eficient. Never use sprtesheet but probably its just adds the logic of animations(sequence of frames) and makes it easier to draw.