This is a test implementation of a simple collision detection routine for map traversal of a sprite. The technique is to figure out which way the sprite is going to try to move, then check a 180 degree arc around the sprite in that direction to see if we're about to bump into a wall - for this simple example I used white for open space and black for obstacle. Use the arrow keys to move the sprite around (currently one step at a time, sorry) and the sprite should stop when it's about to bump into an obstacle.