check if pointer hits rect with checkCollision function