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 integer
s or enum
s 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();
}
精彩评论