Added the bowling challenge.

This commit is contained in:
Marshall
2012-03-17 18:41:01 -04:00
parent 2d7507632d
commit b43f6530ac

View File

@@ -126,13 +126,10 @@ public class PCGLevel extends Level {
if (TESTING) {
length = buildStraight(0, width - 64, true);
length += buildLemmingTrap(length, width - 64 - length,
SpriteTemplate.GOOMPA);
length += buildLemmingTrap(length, width - 64 - length,
SpriteTemplate.GREEN_TURTLE);
length += buildLemmingTrap(length, width - 64 - length,
length += buildBowlingAlley(length, width - 64 - length,
SpriteTemplate.ARMORED_TURTLE);
length += buildLemmingTrap(length, width - 64 - length,
random.nextInt(3) + 1);
length += buildPlatformJump(length, width - 64 - length);
length += buildMaze(length, width - 64 - length);
length += buildPipeJump(length, width - 64 - length);
@@ -191,6 +188,41 @@ public class PCGLevel extends Level {
fillEndPiece(length, floor);
}
private int buildBowlingAlley(int xo, int maxLength, int enemyType) {
if (maxLength >= 26
&& (enemyType == SpriteTemplate.ARMORED_TURTLE || enemyType == SpriteTemplate.GREEN_TURTLE)) {
// Create the pit.
setBlock(xo, this.height - 2, Level.GROUND);
setBlock(xo, this.height - 1, Level.GROUND);
setBlock(xo + 1, this.height - 1, Level.GROUND);
setBlock(xo + 1, this.height - 2, Level.GROUND);
setBlock(xo + 2, this.height - 1, Level.GROUND);
setBlock(xo + 3, this.height - 1, Level.GROUND);
setBlock(xo + 4, this.height - 1, Level.GROUND);
setSpriteTemplate(xo + 2, this.height - 2, new SpriteTemplate(
SpriteTemplate.RED_TURTLE, false));
for (int x = 5; x < 26; x++) {
setBlock(xo + x, this.height - 1, Level.GROUND);
setBlock(xo + x, this.height - 2, Level.GROUND);
setBlock(xo + x, this.height - 3, Level.GROUND);
if (x > 16) {
setSpriteTemplate(xo + x, this.height - 4,
new SpriteTemplate(enemyType, false));
}
}
return 25;
}
return 0;
}
private int buildLemmingTrap(int xo, int maxLength, int enemyType) {
if (maxLength >= 14
&& (enemyType == SpriteTemplate.GOOMPA