If statement 调用if语句,直到它';完成了

If statement 调用if语句,直到它';完成了,if-statement,lwjgl,updates,pause,If Statement,Lwjgl,Updates,Pause,如何调用if语句(或任何其他函数)而不再次调用它,直到它完成执行?我有一个update函数,它调用另一个函数(在另一个类中),但由于它执行每个更新,用户没有时间实际完成IF语句(IF语句依赖于用户输入),因此它不返回任何内容或只返回第一部分 代码(其中更新为): changeTile功能: public void changeTile(){ boolean start = true; if(start){ while(Mouse.next()){

如何调用if语句(或任何其他函数)而不再次调用它,直到它完成执行?我有一个update函数,它调用另一个函数(在另一个类中),但由于它执行每个更新,用户没有时间实际完成IF语句(IF语句依赖于用户输入),因此它不返回任何内容或只返回第一部分

代码(其中更新为):

changeTile功能:

    public void changeTile(){
    boolean start = true;

    if(start){
        while(Mouse.next()){
        if(Mouse.getEventButton() == 0 && Mouse.getEventButtonState()){
                    //system uses tileTypes because player textures are tiletypes itself, so in the end we can let them swim by changing tiletypes
                    int xCoord = (int) Math.floor(Mouse.getX() / 64);
                    int yCoord = (int) Math.floor((HEIGHT - Mouse.getY() - 1) / 64);
                    tileType tile1 = map[xCoord][yCoord].getType();
                    System.out.println("first tile is set to:" + tile1);
                    start = false;
            }
        }
    }

    if(!start){
        while(Mouse.next()){
            if(Mouse.getEventButton() == 0 && Mouse.getEventButtonState()){
                int xCoord2 = (int) Math.floor(Mouse.getX() / 64);
                int yCoord2 = (int) Math.floor((HEIGHT - Mouse.getY() - 1) / 64);
                tileType tile2 = map[xCoord2][yCoord2].getType();
                System.out.println("second tile is set to:" + tile2);
            }
        }
    }

你能把问题说得更具体些吗?我想我不明白。在函数运行时,调用函数时没有再次运行它
    public void changeTile(){
    boolean start = true;

    if(start){
        while(Mouse.next()){
        if(Mouse.getEventButton() == 0 && Mouse.getEventButtonState()){
                    //system uses tileTypes because player textures are tiletypes itself, so in the end we can let them swim by changing tiletypes
                    int xCoord = (int) Math.floor(Mouse.getX() / 64);
                    int yCoord = (int) Math.floor((HEIGHT - Mouse.getY() - 1) / 64);
                    tileType tile1 = map[xCoord][yCoord].getType();
                    System.out.println("first tile is set to:" + tile1);
                    start = false;
            }
        }
    }

    if(!start){
        while(Mouse.next()){
            if(Mouse.getEventButton() == 0 && Mouse.getEventButtonState()){
                int xCoord2 = (int) Math.floor(Mouse.getX() / 64);
                int yCoord2 = (int) Math.floor((HEIGHT - Mouse.getY() - 1) / 64);
                tileType tile2 = map[xCoord2][yCoord2].getType();
                System.out.println("second tile is set to:" + tile2);
            }
        }
    }