Hello
I try to create an engine that will allow me to build tilemaps from a bitmap. I think it will be an easy and memory friendly system to store tilemaps.
Thanks to calminthenight, I managed to adapt this little engine that works this way :
- create a bitmap on transparent background where every pixel represents a tile in the tilemap
- paste bitmap in canvas object, take a snapshot
- scan the snapshot line after line ans check certain color (in the current example, I scan only for red pixels, i.e. where DrawingCanvas.SnapshotRedAt = 62)
- create related tile at same coordinate in the tilemap
The system logic is ok but it seems there is a viewport scale issue, i.e. when my original bitmap is 10x10 pixels, its size changes according to viewport scale when layout is displayed. So the created snapshot could be bigger, a 1x1 pixel could become a 2x2 pixel and the tilemap is not correctly created. Here is the original file : https://www.dropbox.com/s/p4my3kk4tcihbk2/MapFromPixelSprite.c3p?dl=0
Following are two screencap showing how thinks show on screen at different viewport sizes and the image of the original sprite.