Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Finding certain colored pixels

edited December 2013 in General Posts: 577

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?




  • Posts: 1,595

    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.

  • IgnatzIgnatz Mod
    Posts: 5,396

    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.

  • Posts: 577

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

  • Posts: 1,255

    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.

Sign In or Register to comment.