This site requires JavaScript, please enable it in your browser!
Greenfoot back
Dad
Dad wrote ...

2018/2/20

Help with tiles

Dad Dad

2018/2/20

#
Hey there, so I was wondering if there is a way to use a tileset like the one linked that is all a single image. If not, what would be the best way to put tiles like that in the world
danpost danpost

2018/2/20

#
Dad wrote...
<< Image Omitted >> Hey there, so I was wondering if there is a way to use a tileset like the one linked that is all a single image. If not, what would be the best way to put tiles like that in the world
... to what end? I mean, if your world is 11x11 with a cell size equal to 1/11 the width (or height) of the image, you can set the image as your background and each "tile" will be in a single cell. However, you have not given any indication as to why you think a problem would exist with it. (you could also scale the image before setting it to the background, changing it by some multiple of 11 and adjust the cell size accordingly) (also, your cell size could still be 1 and the image scaled to the size of the world)
Dad Dad

2018/2/20

#
Sorry, I wanted to know if there was a way to set the cells as part of that image w/o editing the image, but you cant, so I just have to edit the picture to be just the individual 16x16 tiles.
danpost danpost

2018/2/20

#
Dad wrote...
Sorry, I wanted to know if there was a way to set the cells as part of that image w/o editing the image, but you cant, so I just have to edit the picture to be just the individual 16x16 tiles.
I counted 11x11 tiles in the picture -- but so be it. Like I said, you can set the image to (or draw the image onto) the background of the world (after scaling it, if needed). When you refer to "cells", it is not clear as to whether you are referring to actual world cells or just particular areas within the image. That is, will your world be created with something like 'super(16, 16, 40)' or with more like 'super(560, 560, 1)'?
Dad Dad

2018/2/20

#
Well, the plan was to create tile objects and populate the world with them, and each tile would be 16 x 16, the picture is just a tileset, and with some other programs, they are able to use those pictures to create tiles, but alas, there is no such method in greenfoot
danpost danpost

2018/2/21

#
Just because no method currently exists to do what you want, that does not mean you cannot write one to do what you want. I mean you can create your tile objects and give them an image that is just bit of the image. Just create images of appropriate size and draw the image above on it at different offsets and assign them to the tile objects.
You need to login to post a reply.