java如何实现多人操作骑士飞行棋画MAP类:
package s1java.xmal1;
public class Map {
int[] map=new int[100];//0:普通
int[] luckyTurn=;//1:幸运轮盘
int[] landMine=;//2:地雷
int[] pause=;//3:暂停
int[] timeTunnel=; //4:时空隧道
//给map[]写入各种符号
public void createMap(){
for(inti=0;iluckyTurn.length;i++){
map[luckyTurn[i]]=1;
}
for(inti=0;ilandMine.length;i++){
map[landMine[i]]=2;
}
for(inti=0;ipause.length;i++){
map[pause[i]]=3;
}
for(inti=0;itimeTunnel.length;i++){
map[timeTunnel[i]]=4;
}
}
public void showMap(int playerPos1,int playerPos2){
showLine1(0,31,playerPos1,playerPos2);
showRLine(31,35,playerPos1,playerPos2);
showLine2(35,66,playerPos1,playerPos2);
showLLine(66,69,playerPos1,playerPos2);
showLine1(69,100,playerPos1,playerPos2);
}
public void showLine1(int start,int end,int playerPos1,int playerPos2){
for(int i=start;iend;i++ ){
System.out.print(getGraph(map[i],i,playerPos1,playerPos2));
}
System.out.println();
}
public void showRLine(int start,int end,int playerPos1,int playerPos2){
for(int i=start;iend;i++){
for(int j=0;j73;j++){
System.out.print("");
}
System.out.println(getGraph(map[i],i,playerPos1,playerPos2));
}
}
public void showLine2(int start,int end,int playerPos1,int playerPos2){
for(int i=end-1;i=start;i--){
System.out.print(getGraph(map[i],i,playerPos1,playerPos2));
}
System.out.println();
}
public void showLLine(int start,int end,int playerPos1,int playerPos2){
for(int i=start;iend;i++){
System.out.println(getGraph(map[i],i,playerPos1,playerPos2));
}
}
public String getGraph(int i,int index,int playerPos1,int playerPos2){
String graph=" ";
if(index==playerPos1index==playerPos2){
graph="@@";
}else if(index==playerPos1){
graph="A";
}else if(index==playerPos2){
graph="B";
}else{
switch(i){
case 1:
graph="¤";
break;
case 2:
graph="
推荐阅读
- 有趣的对联谐音解谜游戏,有趣的对联谐音解谜游戏大全
- 退出视频号申请怎么写,怎样退出视频号发布功能
- sqlserver脚本导入数据库表,sqlserver导入sql脚本
- 如何推广手机软件,如何推广手机app
- c语言中的函数怎么关闭 关闭c语言是什么
- 电商如何统计单子的简单介绍
- b站彼岸直播怎么查积分,b站直播等级经验怎么看
- java代码怎么重新开始 java重新开始程序
- 濮阳搜狗网络推广如何收费,搜狗推广是什么工作