IMAGE as tilemap

SGDK only sub forum

Moderator: Stef

Post Reply
hotrodx
Very interested
Posts: 50
Joined: Thu Mar 21, 2019 1:23 pm

IMAGE as tilemap

Post by hotrodx » Sat Mar 30, 2019 8:02 pm

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?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: IMAGE as tilemap

Post by Stef » 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).

hotrodx
Very interested
Posts: 50
Joined: Thu Mar 21, 2019 1:23 pm

Re: IMAGE as tilemap

Post by hotrodx » Sun Mar 31, 2019 3:20 am

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?

Post Reply