78 lines
1.8 KiB
Java
78 lines
1.8 KiB
Java
/**
|
|
* <PRE>
|
|
* CEngine.java
|
|
*
|
|
* Revisions: 1.0 Nov. 17, 2002
|
|
* Created the CEngine class
|
|
*
|
|
* </PRE>
|
|
*
|
|
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
|
* @version Version 1.0, Nov. 17, 2002
|
|
*/
|
|
|
|
public class CEngine {
|
|
|
|
|
|
/**
|
|
*Scan the input file and assign game map to the grid
|
|
*/
|
|
public void scanMap(String inFile){
|
|
try{
|
|
BufferedReader br = new BufferedReader(new FileReader(inFile));
|
|
}
|
|
catch(FileNotFoundException fnfe){
|
|
System.err.println("File not found - CNode.scanMap()" + fnfe);
|
|
}
|
|
|
|
//skip first 5 lines
|
|
try{
|
|
for(int i=0;i<5;br.readLine());
|
|
}
|
|
catch(Exception e){
|
|
System.err.println(e+" when attempting to skip 5 lines of file"+
|
|
" - CNode.scanMap()");
|
|
}
|
|
|
|
for(int x=0; x<15; x++){
|
|
String strTemp = br.readLine();
|
|
for(int y=0; y<15; y++){
|
|
switch(strTemp.charAt(z)){
|
|
case s:
|
|
grid[x][y] = new CTile(x,y,1,false);
|
|
grid[x][y].setSpecial(true);
|
|
grid[x][y].setNibble(false);
|
|
break;
|
|
case f:
|
|
grid[x][y] = new CTile(x,y,1,false);
|
|
grid[x][y].setParam(false);
|
|
break;
|
|
case n:
|
|
grid[x][y] = new CTile(x,y,1,false);
|
|
grid[x][y].setNibble(true);
|
|
grid[x][y].setSpecial(false);
|
|
break;
|
|
//create a wall by default
|
|
default:
|
|
case w:
|
|
grid[x][y] = new CTile(x,y,2,false);
|
|
break;
|
|
}//end switch
|
|
}//end for(y)
|
|
}//end for(x)
|
|
}
|
|
|
|
/**
|
|
* Debugging main for class CEngine.
|
|
* This method will rigorously test my code.
|
|
*
|
|
* <br><br>
|
|
* @param args a String array of command line arguments.
|
|
*/
|
|
public static void main(String[] args) {
|
|
|
|
|
|
}// end of main(String[] args)
|
|
|
|
}// end of class CEngine
|