導航:首頁 > 編程語言 > java製作rpg游戲

java製作rpg游戲

發布時間:2025-06-02 06:26:24

『壹』 推薦java角色扮演游戲

索迪亞之風
號稱史上最強的RPG。游戲有三種角色供扮演,分別使用雙手大劍,槍,單手劍。能帶兩個精靈,精靈附加3種技能。屬性加點,武器打造。游戲採用倒敘的方式。具體劇情記不清。強烈推薦!!!
情劍軒轅
仙掌公司出品,所有的裝備都必須通過自己打造升級。並可以帶4-5個守護神(好像是),推薦。
軒轅劍-天之痕
呃,怎麼說……劇情可以,從開篇到終章連接緊湊。唯一的缺點就是移動太慢(不知道是我的手機問題還是游戲本身)。
你可以去這里下載
http://sjbbs.zol.com.cn/frmView.php?frameon=yes

『貳』 求一個簡單RPG游戲的代碼,JAva編寫的

packagecom.lxi;

importjava.io.BufferedReader;
importjava.io.InputStreamReader;

publicclassRpg{
@SuppressWarnings("unchecked")
publicstaticvoidmain(String[]args)throwsException{
System.out.println("在這里輸入兩個人物進行PK,以英文逗號分隔:[BM,DH,MK]");
BufferedReaderbr=newBufferedReader(newInputStreamReader(System.in));
Class<Person>c1;
Class<Person>c2;
try{
Stringtemp=br.readLine();
String[]str=temp.split(",");
if(str.length!=2){
thrownewException("輸入格式有誤,按默認PK");
}
c1=(Class<Person>)Class.forName("com.lxi."
+str[0].toUpperCase());
c2=(Class<Person>)Class.forName("com.lxi."
+str[1].toUpperCase());
}catch(Exceptione){
//TODOAuto-generatedcatchblock
c1=(Class<Person>)Class.forName("com.lxi.BM");
c2=(Class<Person>)Class.forName("com.lxi.DH");
}
try{
Personp1=c1.newInstance();
Personp2=c2.newInstance();
longtime=System.currentTimeMillis();
longnextTime1=(long)(time+p1.coldTime*1000);//
longnextTime2=(long)(time+p2.coldTime*1000);//發動攻擊的時間
System.out.println("---游戲開始---");
while(true){
longcurrenTime=System.currentTimeMillis();

if(nextTime1<currenTime){//時間到則發動攻擊
p1.hit(p2);
nextTime1+=p1.coldTime*1000+p1.waitTime*1000;//下次攻擊時間=冷卻時間+被暈眩時間
p1.waitTime=0;//回合結束,重置被暈眩時間為0
}
if(nextTime2<currenTime){
p2.hit(p1);
nextTime2+=p2.coldTime*1000+p2.waitTime*1000;
p2.waitTime=0;
}
}
}catch(ClassCastExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}catch(InstantiationExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}catch(IllegalAccessExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}catch(Exceptione){
e.printStackTrace();
}
}
}




packagecom.lxi;

importjava.util.Random;

classBMextendsPerson{
publicBM(){
val=650;
coldTime=1.5;
fight=40;
chanceHit=3;
chanceDefense=3;
waitTime=0;
}

intcount=0;//防禦技能發動的次數
inttemp=40;//攻擊力,值同fight
booleanhitFlag=false;
booleandefenseFlag=false;
Randomrand=newRandom();

publicvoidhit(Personp){
if(rand.nextInt(10)<chanceHit){
fight=fight*2;//發動雙倍攻擊
hitFlag=true;
}
inthurt=p.defense(this);
p.val=p.val-hurt;
fight=temp;//還原為單倍攻擊
if(p.val<=0){
System.out.println(this.getClass().getSimpleName()+"勝出!");
System.exit(0);
}
System.out.println(this.getClass().getSimpleName()+"攻擊"
+p.getClass().getSimpleName()+","
+this.getClass().getSimpleName()
+(this.hitFlag?"發動攻擊技能":"未發動攻擊技能")
+p.getClass().getSimpleName()
+(this.defenseFlag?"發動防禦技能":"未發動防禦技能")
+this.getClass().getSimpleName()+":"+this.val+","
+p.getClass().getSimpleName()+":"+p.val);
hitFlag=false;
defenseFlag=false;
}

publicintdefense(Personp){
if(rand.nextInt(10)<chanceDefense){
if(count!=0){
p.val=p.val-p.fight;
count++;
defenseFlag=true;
if(p.val<=0){
System.out.println(this.getClass().getSimpleName()+"勝出!");
System.exit(0);
}
}
}
returnp.fight;
}
}

classMKextendsPerson{
publicMK(){
val=700;
coldTime=2.5;
fight=50;
chanceDefense=6;
chanceHit=3;
waitTime=0;
}

booleanhitFlag=false;
booleandefenseFlag=false;
Randomrand=newRandom();

publicvoidhit(Personp){
if(rand.nextInt(10)<chanceHit){
p.waitTime=3;//使對方暈眩3s
hitFlag=true;
}
inthurt=p.defense(this);
p.val=p.val-hurt;
if(p.val<=0){
System.out.println(this.getClass().getSimpleName()+"勝出!");
System.exit(0);
}
System.out.println(this.getClass().getSimpleName()+"攻擊"
+p.getClass().getSimpleName()+","
+this.getClass().getSimpleName()
+(this.hitFlag?"發動攻擊技能":"未發動攻擊技能")
+p.getClass().getSimpleName()
+(this.defenseFlag?"發動防禦技能":"未發動防禦技能")
+this.getClass().getSimpleName()+":"+this.val+","
+p.getClass().getSimpleName()+":"+p.val);
hitFlag=false;
defenseFlag=false;
}

publicintdefense(Personp){
if(rand.nextInt(10)<chanceDefense){
defenseFlag=true;
returnp.fight/2;//防禦技能發動,傷害減半
}
returnp.fight;
}
}


packagecom.lxi;

importjava.io.BufferedReader;
importjava.io.InputStreamReader;
importjava.util.Random;

//三個人物的基類
abstractclassPerson{
intval;//生命值
doublecoldTime;//冷卻時間
intwaitTime;//暈眩時間
intfight;//攻擊力
intchanceHit;//發起主動技能的概率
intchanceDefense;//發起防禦技能的概率

abstractvoidhit(Personp);//攻擊技能

abstractintdefense(Personp);//防禦技能,返回被傷害點數
}

classDHextendsPerson{
publicDH(){
val=600;
coldTime=1.0;
fight=30;
chanceHit=3;//表示30%的概率
chanceDefense=3;
waitTime=0;
}

Randomrand=newRandom();
booleanhitFlag=false;//主動技能發動的標識
booleandefenseFlag=false;//防禦技能發動的標識

publicvoidhit(Personp){
if(rand.nextInt(10)<chanceHit){//發動主動技能
inthurt=p.defense(this);
p.val=p.val-hurt;
if(p.val<=0){
System.out.println(this.getClass().getSimpleName()+"勝出!");
System.exit(0);
}
val=val+hurt;
if(val>600)
val=600;
hitFlag=true;//標記主動技能已經發動
}else{//進行普通攻擊
inthurt=p.defense(this);
p.val=p.val-hurt;
if(p.val<=0){
System.out.println(this.getClass().getSimpleName()+"勝出!");
System.exit(0);
}
}
System.out.println(this.getClass().getSimpleName()+"攻擊"
+p.getClass().getSimpleName()+","
+this.getClass().getSimpleName()
+(this.hitFlag?"發動攻擊技能":"未發動攻擊技能")
+p.getClass().getSimpleName()
+(this.defenseFlag?"發動防禦技能":"未發動防禦技能")
+this.getClass().getSimpleName()+":"+this.val+","
+p.getClass().getSimpleName()+":"+p.val);
hitFlag=false;//
defenseFlag=false;//重置標記,下次重用
}

publicintdefense(Personp){
if(rand.nextInt(10)<chanceDefense){
defenseFlag=true;//標記防禦技能已經發動
return0;
}else{
returnp.fight;
}
}
}

『叄』 推薦些經典的JAVA手機游戲,要RPG的

[角色類]Q版龍珠-西遊 [角色類]惡魔的法則-聖戰 [角色類]七界玄魔-真龍覺醒 [角色類]喪屍危機-全城爆發 [角色類]幽情幻劍錄-橫掃天下 樓主可以去155手游天下JAVA專區,按照排行,或人氣下載就可以了。

閱讀全文

與java製作rpg游戲相關的資料

熱點內容
pdf文件怎麼取照片 瀏覽:744
報考大數據與會計有哪些優勢 瀏覽:399
uc領紅包版本 瀏覽:857
qq空間版本大全下載70 瀏覽:747
微信txmv文件 瀏覽:912
電腦c盤里有哪些文件夾 瀏覽:225
所有的圖片如何放到文件夾 瀏覽:950
qq拼音輸入法應用程序錯誤 瀏覽:15
怎樣在word文件上插入字 瀏覽:230
蘋果5s是什麼網路制式 瀏覽:106
app為什麼還有開屏廣告 瀏覽:722
百度盤代碼 瀏覽:631
e4a手機編程怎麼樣 瀏覽:845
xp怎麼安裝回環型網路 瀏覽:455
sketch怎麼創建文件夾 瀏覽:261
ps10分鍾文件存在暫存檔哪裡 瀏覽:634
鄭州編程公司有哪些 瀏覽:728
日本加工中心編程軟體用哪些 瀏覽:151
dwg轉換成jpg工具 瀏覽:904
如何給u盤的文件加密視頻不加密 瀏覽:310

友情鏈接