0

我正在制作二十一点游戏,我有一个随机数生成器生成一个介于 1 和 10 之间的数字。我想要做的是,如果生成的数字是 1,弹出 2 个按钮,让用户可以选择将其设为 1 还是11. 我尝试让按钮按下一个整数,然后将其添加到我的代码中,但它会跳过它。基本上我想让程序需要单击按钮才能继续。

    private void btnPlayActionPerformed(java.awt.event.ActionEvent evt) {                                        
      lblCmnt.setText("");  //resets the comment
    btnHit.setEnabled(true);//lets the user use the hit buttom
    card1= random.nextInt(10) + 1; //draws a random card
    if(card1==1){ //checks if random number is 1
     card1=intAce; //gets variable from button press
    }
4

0 回答 0