开发者

How to draw a gamemap in console?

Im working on a game, developed in console and I have a question of how to draw a map like this in the java console, im using Eclipse and I'm new in java: My game board is a matrix. Points are spaces in the matrix, and 'o' are like walls. ¿Can anyone help me to get something like this??? Thanks

ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo .................................................................................................. .................................................................................................. ......................开发者_如何学C............................................................................ ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo .................................................................................................. .................................................................................................. .................................................................................................. ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo .................................................................................................. .................................................................................................. .................................................................................................. ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo ooooooo..............ooooooo..............ooooooo..............ooooooo


You can use a matrix of integers or enums and draw the matrix as a bunch of characters.

Simple example, given Tile[][] matrix:

for(int row = 0; row < matrix.length; row++) {
   for(int col = 0; col < matrix[0].length; col++) {
      System.out.print(matrix[row][col].getCharacter());
   }
   System.out.println();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜