- 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;
|
int length = 0;
|
||||||
|
|
||||||
if (TESTING) {
|
if (TESTING) {
|
||||||
difficulty = 10;
|
difficulty = 6;
|
||||||
|
|
||||||
length = buildStraight(0, width - 64, true);
|
length = buildStraight(0, width - 64, true);
|
||||||
length += buildFreebie(length, width - 64 - length);
|
length += buildFreebie(length, width - 64 - length);
|
||||||
@@ -130,8 +130,7 @@ public class PCGLevel extends Level {
|
|||||||
SpriteTemplate.ARMORED_TURTLE);
|
SpriteTemplate.ARMORED_TURTLE);
|
||||||
length += buildFreebie(length, width - 64 - length);
|
length += buildFreebie(length, width - 64 - length);
|
||||||
|
|
||||||
length += buildLemmingTrap(length, width - 64 - length,
|
length += buildLemmingTrap(length, width - 64 - length);
|
||||||
random.nextInt(3) + 1);
|
|
||||||
length += buildFreebie(length, width - 64 - length);
|
length += buildFreebie(length, width - 64 - length);
|
||||||
|
|
||||||
length += buildPlatformJump(length, width - 64 - length);
|
length += buildPlatformJump(length, width - 64 - length);
|
||||||
@@ -266,10 +265,14 @@ public class PCGLevel extends Level {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int buildLemmingTrap(int xo, int maxLength, int enemyType) {
|
private int buildLemmingTrap(int xo, int maxLength) {
|
||||||
if (maxLength >= 14
|
if (maxLength >= 14) {
|
||||||
&& (enemyType == SpriteTemplate.GOOMPA
|
int enemyType = shouldAddChallenge() ? (shouldAddChallenge() ? SpriteTemplate.ARMORED_TURTLE
|
||||||
|| enemyType == SpriteTemplate.GREEN_TURTLE || enemyType == SpriteTemplate.ARMORED_TURTLE)) {
|
: SpriteTemplate.GREEN_TURTLE)
|
||||||
|
: SpriteTemplate.GOOMPA;
|
||||||
|
boolean flying = shouldAddChallenge() && shouldAddChallenge()
|
||||||
|
&& shouldAddChallenge();
|
||||||
|
|
||||||
for (int x = 0; x < 18; x++) {
|
for (int x = 0; x < 18; x++) {
|
||||||
if (x > 5) {
|
if (x > 5) {
|
||||||
for (int y = 0; y < 5; y++) {
|
for (int y = 0; y < 5; y++) {
|
||||||
@@ -282,7 +285,7 @@ public class PCGLevel extends Level {
|
|||||||
|
|
||||||
if (x > 6 && x % 2 == 0) {
|
if (x > 6 && x % 2 == 0) {
|
||||||
setSpriteTemplate(xo + x, this.height - 6,
|
setSpriteTemplate(xo + x, this.height - 6,
|
||||||
new SpriteTemplate(enemyType, false));
|
new SpriteTemplate(enemyType, flying));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 18;
|
return 18;
|
||||||
@@ -657,7 +660,12 @@ public class PCGLevel extends Level {
|
|||||||
|
|
||||||
private int buildPlatformJump(int xo, int maxLength) {
|
private int buildPlatformJump(int xo, int maxLength) {
|
||||||
int length = 0;
|
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) {
|
if (numPlatforms > 1) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
@@ -667,9 +675,9 @@ public class PCGLevel extends Level {
|
|||||||
ArrayList<LevelComponent.PlatformLevel> jumps = new ArrayList<LevelComponent.PlatformLevel>();
|
ArrayList<LevelComponent.PlatformLevel> jumps = new ArrayList<LevelComponent.PlatformLevel>();
|
||||||
int heightMod = 0;
|
int heightMod = 0;
|
||||||
int lastHeightMod = 0;
|
int lastHeightMod = 0;
|
||||||
|
int enemyType;
|
||||||
|
|
||||||
jumps.add(random.nextBoolean() ? LevelComponent.PlatformLevel.BOT
|
jumps.add(LevelComponent.PlatformLevel.BOT);
|
||||||
: LevelComponent.PlatformLevel.MID_D);
|
|
||||||
|
|
||||||
for (int i = 1; i < numPlatforms; i++) {
|
for (int i = 1; i < numPlatforms; i++) {
|
||||||
last = jumps.get(i - 1);
|
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 + 2, this.height - heightMod, Level.ROCK);
|
||||||
setBlock(xo + length + 3, 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