Page 1 of 1

IMAGE as tilemap

Posted: Sat Mar 30, 2019 8:02 pm
by hotrodx
I find rescomp's IMAGE export to be very useful. Basically exports a Tileset + Palette + Map from an image source, taking care of duplicates and flipped tiles. Since it reads from an image source, any tilemap editor that exports an image can be used.

I'm thinking of using IMAGE as some sort of game level, but I was wondering how I can identify the tile ID during collision? Since the map can be optimized, how do I determine if tile in x, y is collidable or not?

Re: IMAGE as tilemap

Posted: Sat Mar 30, 2019 8:44 pm
by Stef
Unfortunately you don't have easy way to do that right now using rescomp.
I plan to add features to help with that but currently the best way to do it is using a separate image representing the collision informations (using specific tiles for that).

Re: IMAGE as tilemap

Posted: Sun Mar 31, 2019 3:20 am
by hotrodx
Stef wrote:
Sat Mar 30, 2019 8:44 pm
Unfortunately you don't have easy way to do that right now using rescomp.
I plan to add features to help with that but currently the best way to do it is using a separate image representing the collision informations (using specific tiles for that).
Using a separate image for collision isn't a bad idea, since it resides in ROM and doesn't have to be actually loaded into RAM to check. Now why didn't I think of that?

I'm assuming all empty/transparent grid in the tilemap will have a value of 0. Is that correct? The rest would be the collision tiles?

Let's say I have diagonal collisions. If I arrange the unique tiles starting at the upperleft corner of the map (actually at 1, 0), will the tilemap values be exported like:
[0, 1, 2, 3, 4, ...] // first row of map
[0, 0, 0, 0, 0, ...] // second row map, or the rest of the actual collision map
with flipping export turned off (so opposite slopes are unique).

Of course I have to make the upperleft edge of the collision map unreachable by the player (not a problem for platformers).

Is the above idea feasible?