Created the "CheckCollision" method on Barrier class.