日期:2014-05-20  浏览次数:20871 次

地图编辑器怎么用?生成.map的文件后在程序中怎么用阿 ?
地图编辑器怎么用?生成.map的文件后在程序中怎么用阿 ?
另外请推荐一款好点的地图编辑器以及下载地址?
如果能发到邮箱更是感激不尽!
wyb_boy@163.com

------解决方案--------------------
这要看是哪个地编生成的吧.
------解决方案--------------------
那要看那个地图编程器了三,

如果.map文件中没有把图片资源读进去,那么代码要画地图时要先读.map文件后把图片也加载了。
------解决方案--------------------
关注

------解决方案--------------------

生成.map文件后要看你是画的几层地图,如果是1层的话还需要个类把它转换下
import java.io.*;

public class ReadMap
{
public static void main(String[] args)
{
new ReadMap().run();
}

public void run()
{
try{
FileInputStream fis = new FileInputStream("1.map");
FileOutputStream fos = new FileOutputStream("1.dat");

int t = 0;
int count = 0;
while((t = fis.read()) != -1)
{
++count;
if(count < 5)
{
if(count < 3)
{
fos.write(t);
}
}
else 
{
if(count % 2 == 1)
{
if(t != 0)
fos.write(--t);
}
}
}
fis.close();
fos.close();
}catch(IOException e)
{

}finally
{

}
}
}


然后把转换后的文件防止res包里再写个地图类来画。
import java.io.*;
import javax.microedition.lcdui.*;

public class Map
{
byte[][] data;
Image mapImage;

public Map()
{

}

public void getDataes()
{
try
{
InputStream is = getClass().getResourceAsStream("/1.dat");

int _w = is.read();
int _h = is.read();

data = new byte[_h][_w];

for(int i = 0; i < _h; i++)
{
byte[] _b = new byte[_w];
is.read(_b);
data[i] = _b;
}
is.close();
}
catch(Exception e)
{
System.out.println("MAP ERROR");
}
/* 
for(int i = 0; i < data.length; i++)
{
for(int j = 0; j < data[i].length; j++)
{
System.out.print(" " + data[i][j]);
}
System.out.println();
} */
}

}