收藏 分享(赏)

游戏代码2.doc

上传人:kpmy5893 文档编号:12431428 上传时间:2021-12-12 格式:DOC 页数:9 大小:77KB
下载 相关 举报
游戏代码2.doc_第1页
第1页 / 共9页
游戏代码2.doc_第2页
第2页 / 共9页
游戏代码2.doc_第3页
第3页 / 共9页
游戏代码2.doc_第4页
第4页 / 共9页
游戏代码2.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

1、画 MAP 类:package s1java.xmal1;public class Map int map=new int100; /0:普通int luckyTurn=6,23,40,55,69,83; /1:幸运轮盘int landMine=5,13,17,33,38,50,64,80,94;/2:地雷int pause=9,27,60,93; /3:暂停int timeTunnel=20,25,45,63,72,88,90; /4:时空隧道/给 map写入各种符号public void createMap()for(int i=0;i=start;i-)System.out.print(

2、getGraph(mapi,i,playerPos1,playerPos2);System.out.println();public void showLLine(int start,int end,int playerPos1,int playerPos2)for(int i=start;i99)return 99;switch(map.mapposition)case 0:/普通格if(no=1System.out.println(“:-D 哈哈哈.踩到了!“);else if(no=2System.out.println(“:-D 哈哈哈.踩到了!“);break;case 1:/幸运轮

3、盘System.out.println(“n欢迎进入幸运轮盘“);System.out.println(“请选择一种运气:“);System.out.println(“1.交换位置 2.轰炸对手“);int choice=input.nextInt();int temp;switch(choice)case 1: /交换位置if(no=1)temp=position;position=playerPos2;playerPos2=temp;else if(no=2)temp=position;position=playerPos1;playerPos1=temp;break;case 2: /轰

4、炸对手if(no=1)if(playerPos2_99)return 99;elsereturn position;public void judge()if(playerPos1playerPos2)System.out.println(“玩家 1“+playerName0+“最先到达终点,获得胜利。恭喜!恭喜!“);elseSystem.out.println(“玩家 2“+playerName1+“最先到达终点,获得胜利。恭喜!恭喜!“);public void play()System.out.println(“nnnn“);System.out.println(“nn“);Syste

5、m.out.println(“ Game Start n“);System.out.println(“nn“);System.out.println(“_“+playerName0+“的士兵: A“);System.out.println(“_“+playerName1+“的士兵: Bn“);System.out.println(“n 图例:“+“ 暂停 ¤幸运轮盘 地雷 时空隧道 普通n“);map.showMap(playerPos1, playerPos2);int step;while(playerPos199System.out.println(“n-“);System.o

6、ut.println(“骰子数“+step);playerPos1=getCurPos(1,playerPos1,step);System.out.println(“你“+playerName0+“当前的位置:“+playerPos1);System.out.println(“对手“+playerName1+“当前的位置:“+playerPos2);System.out.println(“n-“);map.showMap(playerPos1, playerPos2);if(playerPos1=99)break;elseSystem.out.println(“n“+playerName0+“

7、停掷一次。n“);goAndStop0=“on“;System.out.println(“nnnn“);if(goAndStop1.equals(“on“)step= throwShifter(2);System.out.println(“n-“);System.out.println(“骰子数“+step);playerPos2=getCurPos(2,playerPos2,step);System.out.println(“你“+playerName1+“当前的位置:“+playerPos2);System.out.println(“对手“+playerName0+“当前的位置:“+pla

8、yerPos1);System.out.println(“n-“);map.showMap(playerPos1, playerPos2);if(playerPos2=99)break;elseSystem.out.println(“n“+playerName1+“停掷一次。n“);goAndStop1=“on“; System.out.println(“nnnn“);System.out.println(“nnnn“);System.out.println(“n*n“);System.out.println(“ Game Over n“);System.out.println(“*nn“);

9、judge(); public void start()init();System.out.println(“n“);System.out.println(“/ /“);System.out.println(“/ /“);System.out.println(“/ 骑士飞行棋 /“);System.out.println(“/ /“);System.out.println(“/ /“);System.out.println(“);System.out.println(“两人对战“);System.out.println(“请选择角色:1.比尔 2.奥巴马 3.普京 4.布朗“);System.

10、out.println(“请玩家 1 选择角色:“);int role1=input.nextInt();int role2;doSystem.out.println(“请玩家 2 选择角色:“);role2=input.nextInt();while(role2=role1);setRole(1,role1);setRole(2,role2);play();主方法类:package s1java.xmal1;public class StartGame public static void main(String args) Game game=new Game();game.start();

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 实用文档 > 解决方案

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报