导航:首页 > 编程语言 > 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游戏相关的资料

热点内容
苹果6s截图声音怎么关 浏览:849
bibi怎么看后台数据 浏览:122
chrome视频缓存文件夹 浏览:546
数据库自加一 浏览:992
家具榫卯铣型用哪个软件编程好 浏览:46
如何把u盘文件夹里的文件拉出来 浏览:15
从手机到电脑的备份文件找不到 浏览:810
监控网络怎么配置 浏览:255
网络断断续续怎么回事 浏览:659
三国10兵种升级 浏览:534
javascript邮箱格式 浏览:761
dns的文件怎么打开 浏览:473
数据怎么导入扫描枪步骤 浏览:319
微信朋友圈被朋友屏蔽了 浏览:279
eclipse导出源码成word文件 浏览:306
微信表情包规格 浏览:384
回收站恢复的文件找不到了 浏览:180
java生成识别码 浏览:126
文件存到哪个盘对电脑没影响 浏览:299
存储卡找不到迅雷下载文件 浏览:149

友情链接