public void teleport(boolean isTeleport, Teleport teleport) {
        if (isTeleport == true) {
            if (vx > 0) {
                if (x >= teleport.getX1() && y + r >= teleport.getY1() && y <= teleport.getY1() + teleport.getHeight()) {
                    vx *= randomSwitchDirection();
                    vy *= randomSwitchDirection();
                    x = teleport.getX2();
                    y = teleport.getY2() + 2 * r;
                    //changeDirection();
                }
            }
            if (vx < 0) {
                if (x <= teleport.getX1() + teleport.getWidth() && y + r >= teleport.getY1() && y <= teleport.getY1() + teleport.getHeight()) {
                    vx *= randomSwitchDirection();
                    vy *= randomSwitchDirection();
                    x = teleport.getX2();
                    y = teleport.getY2() + 2 * r;
                    //changeDirection();
                }
            }
        }
    }