gilbert189 @gilbert189
// BABA IS JAVA
public BabaIsYou extends Map implements Level
{
	Board board;
	BabaObject baba;
	BabaObject wall;
	BabaObject rock;
	BabaObject flag;
	BabaObject tile; // decoration, no rules
	BabaIsYou()
	{
		// this is cutscene accurate
		board.setOrigin(Board.CENTER);
		
		// assemble objects
		baba = new BabaObject("BABA");
		board.assemble.put(baba, -4, 0);
		wall = new BabaObject("WALL");
		board.assemble.line(wall, -5, 2, 5, 2);
		board.assemble.line(wall, -5, -2, 5, -2);
		rock = new BabaObject("ROCK");
		board.assemble.line(wall, 0, 1, 0, -2);
		flag = new BabaObject("FLAG");
		board.assemble.put(flag, 4, 0);
		
		// add rules
		board.rules.add(Rule(wall, Operator.IS, Property.STOP), -5, -4);
		board.rules.add(Rule(flag, Operator.IS, Property.WIN), 5, 4);
		board.rules.add(Rule(rock, Operator.IS, Property.PUSH), 5, -4);
		board.rules.add(Rule(baba, Operator.IS, Property.YOU), -5, 4); // !!!

		tile = new BabaObject("TILE");
		board.assemble.fillEmpty(tile, -5, -1, 5, -1);
	}
}
Nov 7, 2021, 3:45 PM
0

comments