code for reading from map and collision detection (calculation)