add collision detection for top and bottom walls