Consolidated all map collision detection into single method in map.js