Hi,
I recently started using SDL and have run into a question of how to format a 2D level's collidable surfaces:
1) Use an image consisting of two colors; one representing walkable space, and the other filled space. I'd constantly get the color of the pixel the character(and other entities) are standing on and detect a collision if it changes color.
2) I use an array of rectangles(with points, widths, etc) and check every single entity against every single rectangle for a collision.
I'm wondering which of these methods is most efficient for the CPU and RAM. My guess is that 1) is best for CPU and 2) is best for RAM but would like elaboration. I like the idea of 1) just because I could draw up a level in PS really quick and immediately have it good to go (assuming my code is robust enough).
Thanks!