implemented wall collision detection