开发者

How to draw a gamemap in console?

开发者 https://www.devze.com 2023-04-06 05:12 出处:网络
Im working on a game, developed in consoleand 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

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

精彩评论

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

关注公众号