java打架游戏_初学JAVA 好玩的打架小游戏代码 -

初学JAVA 好玩的打架小游戏代码 -

温柔似野鬼°

911次浏览

2020年08月01日 15:39

最佳经验

本文由作者推荐

mit是什么意思-拥挤的反义词import nPane;

public class GameWithNumbers_GroupProject

{

public static void main(String[] args)

{

//Create buttons for you to choose the game.

Object[] options ={ "Game fight", "Find mere", "Guess numbers","Quit" };

int button = tionDialog(null, "Which action you want to do next?", "Combat Control Panel",

_NO_CANCEL_OPTION, ON_MESSAGE, null, options, options[0]);

if (button == _OPTION)

{

{

Object[] options1 ={ "Attack", "Heal", "Quit" };

int myap = 0

int enap = 0

int myhp = 500;

int enemyhp = 500;

ssageDialog(null, "This is a Fighting Game

You and your enemy both have 500 blood

You can choose attack your enemy or heal yourself next");

while (myhp > 0 && enemyhp > 0){

int myattack = (int)(()*100);

int enemyattack = (int)(()*100);

int myheal = (int)(()*50);

int enemyheal = (int)(()*50);

int i = tionDialog(null, "Which action you want to do next?", "Combat Control Panel",_NO_CANCEL_OPTION, ON_MESSAGE, null, options1, options[0]);

if (i == _OPTION){

if (myap != 100){

enemyhp-=myattack;

enap += 25;

if(enemyhp <= 0){ssageDialog(null,"You have attacked your enemy this turn

Your HP: " + myhp + ",

Your enemy's HP:" + "0" + "

Get into your enemy's turn?")

;

break;}

else{

ssageDialog(null,"You have attacked your enemy this turn

Your HP: " + myhp + ",

Your enemy's HP:" + enemyhp + "

Get into your enemy's turn?");

}}else{enemyhp-=myattack*2;

enap += 25;

myap = 0

if(enemyhp <= 0){ssageDialog(null,"You have attacked your enemy"

+ " critically this turn

Your HP: " + myhp + ",

Your enemy's HP:" + "0" +

"

Get into your enemy's turn?");

break;}

else{

ssageDialog(null,"You have attacked your enemy critially this "

+ "turn

Your HP: " + myhp + ",

Your enemy's HP:" + enemyhp +

"

Get into your enemy's turn?");

}}

if (i == _OPTION){

myhp+=myheal;if (myhp >= 1000){

myhp = 1000;}

}

ssageDialog(null,"You have healed yourself this turn

Your HP: " + myhp + ",

Your enemy's HP:" + enemyhp + "

Get into your enemy's turn?");

}

if (i == _OPTION){

break;

}

int enemyif = (int)(()*2);

if (enemyif == 0){if(enap !=100){

myhp-=enemyattack;

myap+=25;

if(myhp>=0){ssageDialog(null,"Your enemy has attacked you this turn

Your HP: " + myhp + ",

Your enemy's HP: " + enemyhp + "

Do you want to get into your turn?");

}

else

{ssageDialog(null,"Your enemy has attacked you this turn

Your HP: " + "0" + ",

Your enemy's HP: " + enemyhp + "

Do you want to get into your turn?");

break;}}

else{myhp-=enemyattack*2;

myap+=25;

enap = 0;

if(myhp>=0){

ssageDialog(null,"Your enemy has attacked you "

+ "critically this turn

Your HP: " + myhp +

",

Your enemy's HP: " + enemyhp + "

Do you want to get "

+ "into your turn?");}

else{ssageDialog(null,"Your enemy has attacked you "

+ "critically this turn

Your HP: " + "0" +

",

Your enemy's HP: " + enemyhp + "

Do you want to get "

+ "into your turn?");

break;}

}

}

if (enemyif == 1){

enemyhp+=enemyheal;

if(enemyhp >= 1000){enemyhp = 1000;}

ssageDialog(null,"Your enemy has healed himself this turn

your HP: " + myhp + ",

Your enemy's HP:" + enemyhp + "

Do you want to get into your turn?");

}

}

if (myhp <= 0){

ssageDialog(null,"You die, Game Over");

}

if (enemyhp <= 0){

ssageDialog(null,"Your enemy die, You are the winner!");

}

else{

ssageDialog(null,"The Player Quit The Game");

}

}

}

if (button == _OPTION)

{

//Prompt user enter his or her birthday.

int birthmonth=nt(putDialog(null,"Enter the month "

+ "you were born in(1 to 12):"));

int birthdate=nt(putDialog(null,"Enter the day "

+ "you were born in:"));

Constellation1(birthmonth,birthdate);

}

if (button == _OPTION)

{

//Create the number and tell reader whether it is prime number:

int guess=(int)(()*99+2);

int guess1=(int)((guess,0.5));

String judge="";

for (int check=2; check<=guess1;check++)

{

if(guess % check == 0)

judge="The number you will guess is not a prime number";

else

judge="The number you will guess is a prime number";

}

ssageDialog(null,judge);

//Prompt user to input the number

int user=nt(putDialog(null,"Guess the number(2 to 100): "));

do

{

if(userssageDialog(null,"The number you guessed is too low, please try again!");

if(user>guess)

ssageDialog(null,"The number you guessed is too large, please try again!");

u

ser=nt(putDialog(null,"Guess the number(2 to 100): "));

}

while(user != guess);

ssageDialog(null,"You got the right answer!","Congratulations!",2);

}

}

public static int Constellation1(int month, int date)

{

if((month==3 && date>=21 && date<=31)||(month==4 && date>=1 && date<=19))

{ssageDialog(null,"You are Aries!");}

else if((month==4 && date>=20 && date<=31)||(month==5 && date>=1 && date<=20))

{ssageDialog(null,"You are Taurus!");}

else if((month==5 && date>=21 && date<=31)||(month==6 && date>=1 && date<=21))

{ssageDialog(null,"You are Gemini!");}

else if((month==6 && date>=22 && date<=30)||(month==7 && date>=1 && date<=22))

{ssageDialog(null,"You are Cancer!");}

else if((month==7 && date>=23 && date<=31)||(month==8 && date>=1 && date<=22))

{ssageDialog(null,"You are Leo!");}

else if((month==9 && date>=1 && date<=22)||(month==8 && date>=23 && date<=31))

{ssageDialog(null,"You are Virgo!");}

else if((month==9 && date>=23 && date<=30)||(month==10 && date>=1 && date<=22))

{ssageDialog(null,"You are Libra!");}

else if((month==11 && date>=1 && date<=21)||(month==10 && date>=23 && date<=31))

{ssageDialog(null,"You are Scorpio!");}

else if((month==11 && date>=22 && date<=30)||(month==12 && date>=1 && date<=21))

{ssageDialog(null,"You are Sagittarius!");}

else if((month==1 && date>=1 && date<=19)||(month==12 && date>=22 && date<=31))

{ssageDialog(null,"You are Capricorn!");}

else if((month==1 && date>=20 && date<=31)||(month==2 && date>=1 && date<=18))

{ssageDialog(null,"You are Aquarius!");}

else

{ssageDialog(null,"You are Pisces!");}

return Constellation2(month,date);

}

public static int Constellation2(int month, int date)

{tt

month=(int)(()*12+1);

if(month==4 || month==6 || month==9 || month==11)

date=(int)(()*31+1);

else if(month==2)

date=(int)(()*29+1);

else

date=(int)(()*30+1);

String monthname="";

switch(month)

{

case 1:

monthname="January";

break;

case 2:

monthname="Feburary";

break;

case 3:

monthname="March";

break;

case 4:

monthname="April";

break;

case 5:

monthname="May";

break;

case 6:

monthname="June";

break;

case 7:

monthname="July";

break;

case 8:

monthname="August";

break;

case 9:

monthname="September";

break;

case 10:

monthname="October";

break;

case 11:

monthname="November";

break;

default:

monthname="December";

break;

}

JOptionP

ssageDialog(null, "You should find a fere whose birthday is "+date+

"th of "+monthname);

(0);

return Constellation1(month,date);t

}

}

全微分的几何意义-修葺的意思

觑的读音-见笑了是什么意思

爸爸怎么读-卷棚顶

疯狂的日子-垂柳拼音

李煌-自效

shadow是什么意思-萦绕怎么读

孔雀是鸟类吗-不以为然的近义词

潜力英语-林卡

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值