- Fixed another platform jumping impossibility bug.
- Added monsters to platform jumping. - Difficulty is now hard-coded to six.
This commit is contained in:
@@ -121,7 +121,7 @@ public class PCGLevel extends Level {
|
||||
int length = 0;
|
||||
|
||||
if (TESTING) {
|
||||
difficulty = 10;
|
||||
difficulty = 6;
|
||||
|
||||
length = buildStraight(0, width - 64, true);
|
||||
length += buildFreebie(length, width - 64 - length);
|
||||
@@ -130,8 +130,7 @@ public class PCGLevel extends Level {
|
||||
SpriteTemplate.ARMORED_TURTLE);
|
||||
length += buildFreebie(length, width - 64 - length);
|
||||
|
||||
length += buildLemmingTrap(length, width - 64 - length,
|
||||
random.nextInt(3) + 1);
|
||||
length += buildLemmingTrap(length, width - 64 - length);
|
||||
length += buildFreebie(length, width - 64 - length);
|
||||
|
||||
length += buildPlatformJump(length, width - 64 - length);
|
||||
@@ -266,10 +265,14 @@ public class PCGLevel extends Level {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int buildLemmingTrap(int xo, int maxLength, int enemyType) {
|
||||
if (maxLength >= 14
|
||||
&& (enemyType == SpriteTemplate.GOOMPA
|
||||
|| enemyType == SpriteTemplate.GREEN_TURTLE || enemyType == SpriteTemplate.ARMORED_TURTLE)) {
|
||||
private int buildLemmingTrap(int xo, int maxLength) {
|
||||
if (maxLength >= 14) {
|
||||
int enemyType = shouldAddChallenge() ? (shouldAddChallenge() ? SpriteTemplate.ARMORED_TURTLE
|
||||
: SpriteTemplate.GREEN_TURTLE)
|
||||
: SpriteTemplate.GOOMPA;
|
||||
boolean flying = shouldAddChallenge() && shouldAddChallenge()
|
||||
&& shouldAddChallenge();
|
||||
|
||||
for (int x = 0; x < 18; x++) {
|
||||
if (x > 5) {
|
||||
for (int y = 0; y < 5; y++) {
|
||||
@@ -282,7 +285,7 @@ public class PCGLevel extends Level {
|
||||
|
||||
if (x > 6 && x % 2 == 0) {
|
||||
setSpriteTemplate(xo + x, this.height - 6,
|
||||
new SpriteTemplate(enemyType, false));
|
||||
new SpriteTemplate(enemyType, flying));
|
||||
}
|
||||
}
|
||||
return 18;
|
||||
@@ -657,7 +660,12 @@ public class PCGLevel extends Level {
|
||||
|
||||
private int buildPlatformJump(int xo, int maxLength) {
|
||||
int length = 0;
|
||||
int numPlatforms = random.nextInt((maxLength - 3) / 8);
|
||||
int gapLength;
|
||||
|
||||
for (gapLength = 1; shouldAddChallenge() && gapLength < 4; gapLength++) {
|
||||
}
|
||||
|
||||
int numPlatforms = random.nextInt((maxLength - 3) / (4 + gapLength));
|
||||
|
||||
if (numPlatforms > 1) {
|
||||
boolean found = false;
|
||||
@@ -667,9 +675,9 @@ public class PCGLevel extends Level {
|
||||
ArrayList<LevelComponent.PlatformLevel> jumps = new ArrayList<LevelComponent.PlatformLevel>();
|
||||
int heightMod = 0;
|
||||
int lastHeightMod = 0;
|
||||
int enemyType;
|
||||
|
||||
jumps.add(random.nextBoolean() ? LevelComponent.PlatformLevel.BOT
|
||||
: LevelComponent.PlatformLevel.MID_D);
|
||||
jumps.add(LevelComponent.PlatformLevel.BOT);
|
||||
|
||||
for (int i = 1; i < numPlatforms; i++) {
|
||||
last = jumps.get(i - 1);
|
||||
@@ -756,7 +764,23 @@ public class PCGLevel extends Level {
|
||||
setBlock(xo + length + 2, this.height - heightMod, Level.ROCK);
|
||||
setBlock(xo + length + 3, this.height - heightMod, Level.ROCK);
|
||||
|
||||
length += 8;
|
||||
if (shouldAddChallenge()) {
|
||||
|
||||
enemyType = shouldAddChallenge() ? (shouldAddChallenge() ? (shouldAddChallenge() ? SpriteTemplate.ARMORED_TURTLE
|
||||
: SpriteTemplate.RED_TURTLE)
|
||||
: SpriteTemplate.GREEN_TURTLE)
|
||||
: SpriteTemplate.GOOMPA;
|
||||
|
||||
setSpriteTemplate(
|
||||
xo + length + 3,
|
||||
this.height - heightMod - 1,
|
||||
new SpriteTemplate(
|
||||
enemyType,
|
||||
(enemyType == SpriteTemplate.RED_TURTLE && shouldAddChallenge())
|
||||
|| enemyType != SpriteTemplate.RED_TURTLE));
|
||||
}
|
||||
|
||||
length += 4 + gapLength;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user