Commits

Nikolaos Margaris  committed 6f5e554

...adding doors support

  • Participants
  • Parent commits 214c898

Comments (0)

Files changed (5)

File bin/com/nima/quest1.hq

 name=A Growl of Thunder
 map=eeeeeeeeeeemeteeeeeeeeeeeetuuuufeeeeeemeuuuuuuuuuuueeuuuueeeeeeeeeuuuuuuuuuuuteuuuueeeeeeeeeuuuuuuuuuuueeuuuueeeeeeeeeuuuuuuuuuuueeuuuuemeeeeeeeuuuemeeeeeeeeuuuueeeeeeeeeeeeeeemeeeeeeuuuumemeeeeeeeeeemeeeeeeeeuuuueeeeeeeeeffeeemeeeeeeeeeeeeeeeeeeeeffeeeeeeeetetemeeuuuueeeeeffeuuuueeeeeemeemuuuueeeeeeeeuuuueeeeeeeeeeuuuueeeeeeeeuuuueeeeeefffeemeeuuuetemeeuuueeeeeeuuuueeemuuueemffmemeeeeeeeuuuumeeeuuueeeffeeeeeeeeeeuuuuemeeuuueemffeeeeeeteeeuuuueeeeuuuteeemeemeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+doors=10,4,w,h;10,6,w,v;13,6,w,h;26,6,w,v;17,7,e,v;21,9,e,v;4,10,s,h;7,10,n,v;10,10,e,v;24,10,n,v;23,14,s,v;26,14,w,v;19,17,w,h;22,17,w,v;7,19,n,v
 text=You have traveled far and wide...
 notes=Empty for now...
 max_heroes=2

File src/com/nima/Game.java

 		this.quest = new Quest(questProps.getProperty("name"), questProps.getProperty("map"),
 				questProps.getProperty("text"), questProps.getProperty("notes"));
 		this.board.configure(questProps.getProperty("map").toCharArray());
+		this.board.setupDoors(questProps.getProperty("doors"));
 		this.maxNumberOfHeroes = Integer.valueOf(questProps.getProperty("max_heroes"));
 	}
 	

File src/com/nima/GameBoard.java

 		}
 	}
 	
+	public void setupDoors(String doors_property){
+		for(String door : doors_property.split(";")){
+			String[] door_info = door.split(",");
+			int col = Integer.parseInt(door_info[0]) - 1;
+			int line = Integer.parseInt(door_info[1]) - 1;
+			this.tiles[line][col].setConnection(door_info[2].charAt(0), "h".equals(door_info[3]));			
+		}		
+	}
+	
 	public String export(){
 		StringBuilder sb = new StringBuilder();
 		for(int row = 0; row < VMAX; row++){

File src/com/nima/GameTile.java

 		}
 	}
 	
+	//this object preserves the door-connection of a tile towards another
+	private class Connection{
+		private char direction;		
+		private boolean hidden;
+		
+		public char getDirection(){
+			return direction;
+		}
+		public boolean isHidden(){
+			return hidden;
+		}		
+		
+		public Connection(char direction, boolean hidden){
+			this.direction = direction;
+			this.hidden = hidden;
+		}
+	}
+	
 	public GameTile(char c){
 		this.type = Type.fromChar(c);
 	}
 
 	private Type type;
 	private Object roomId;
+	private Connection connection;
 	
+	public Connection getConnection() {
+		return connection;
+	}
+
+	public void setConnection(char direction,  boolean hidden) {
+		this.connection = new Connection(direction, hidden);
+	}
+
 	public Type getType(){
 		return type;
 	}

File src/com/nima/quest1.hq

 name=A Growl of Thunder
 map=eeeeeeeeeeemeteeeeeeeeeeeetuuuufeeeeeemeuuuuuuuuuuueeuuuueeeeeeeeeuuuuuuuuuuuteuuuueeeeeeeeeuuuuuuuuuuueeuuuueeeeeeeeeuuuuuuuuuuueeuuuuemeeeeeeeuuuemeeeeeeeeuuuueeeeeeeeeeeeeeemeeeeeeuuuumemeeeeeeeeeemeeeeeeeeuuuueeeeeeeeeffeeemeeeeeeeeeeeeeeeeeeeeffeeeeeeeetetemeeuuuueeeeeffeuuuueeeeeemeemuuuueeeeeeeeuuuueeeeeeeeeeuuuueeeeeeeeuuuueeeeeefffeemeeuuuetemeeuuueeeeeeuuuueeemuuueemffmemeeeeeeeuuuumeeeuuueeeffeeeeeeeeeeuuuuemeeuuueemffeeeeeeteeeuuuueeeeuuuteeemeemeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+doors=10,4,w,h;10,6,w,v;13,6,w,h;26,6,w,v;17,7,e,v;21,9,e,v;4,10,s,h;7,10,n,v;10,10,e,v;24,10,n,v;23,14,s,v;26,14,w,v;19,17,w,h;22,17,w,v;7,19,n,v
 text=You have traveled far and wide...
 notes=Empty for now...
 max_heroes=2