I wanted to ask, how I can make a Tilemap.
I searched the forums, but couldn’t find a tutorial or something like that.
If someone could explain how to make a Tilemap or if someone has code for it, I would be really thankful
I have tried it for hours, but couldn’t get it to work
Thanks in advance for any help
If you want a rect tilemap, you could use this ( I put stroke in there to make it look like real tiles)
for i = 1,30 do strokeWidth(3) rect(100*i, 0, 100, 100) rect(100, 100*i, 100, 100)
Just fix my code a little, that’s all I know for making tiles easily, besides tables with I am HORRIBLE at.
@code_maker Wouldn’t you use a 2D for loop to make a tile map? And either way, you should always use a table, and if nothing changes, it’s a good idea to draw the map into an image in setup.
No, I haven’t seen it. Where can I find it?
Here is the link for the 3D-Tilemap. It is exactly what I want to make.
The series starts here: https://coolcodea.wordpress.com/2014/09/09/156-creating-a-2d-platform-game-part-1/
@Leon- the simplest way is to create a big new picture in a drawing program, then paste the images you want into that picture, making sure they don’t overlap.
If all your images are the same size, you can space them evenly so your program knows where to find them. Otherwise, your drawing program can tell you the pixel positions of each image - you need the bottom left x,y position (where y is 0 at the bottom and increases upwards), and the width and height.
Once you open the tilemap picture in Codea, you can use the
copy command to pull each image out, as part of the
--x,y is bottom left, w,h is width, height image1 = BigPicture:copy(x,y,w,h)
and now you have all the images separated.
Do you mean tile map as in a texture atlas/ sprite sheet? I think @Ignatz 's solution is describing a texture atlas. Or do you mean a map for a large tiled level, as in a platform game?
@Leon Are you after something like this that I posted in July 2014.
thanks for your answers
I have seen a 3D-Tilemap example that someone posted. I would like to do the same, but in 2D.
It sounds like you’re talking about a map for a tile-based level. Have you seen the 2D platform game that @Ignatz blogged?