Finding certain colored pixels

Hi! For a project I’m working on, I made a tile-map, or background in gimp. I just realized I need a collision around some of the pixels ex: Tree bark. Is there anyway to do this?



I have an example on CC that shows a physics ball and box (no angles) using img:get() to find grey pixels of a certain colour value. If that is what your looking for it should help.

If you’re planning to continually test what your player is walking into, you are probably better to use a table in memory and split your map into tiles. Then you just check what is in the current tile.

@Ignatz I thought of that, but I’m not sure how well Codea would stand up to if the map was 12,000 tiles.

Actually, you’ll find that doing this sort of table test is something at which Lua excels. 12,000 tiles? Eh, that’s not even a 110 by 110 grid. Near enough instantaneous.