Merge branch 'master' of woodyfolsom.net:/opt/git/cs8803p3
This commit is contained in:
@@ -619,53 +619,54 @@ public class PCGLevel extends Level {
|
|||||||
: PlayerProfile.ChallengeRewardType.JUMP); numPipes++) {
|
: PlayerProfile.ChallengeRewardType.JUMP); numPipes++) {
|
||||||
}
|
}
|
||||||
|
|
||||||
localHeight = random.nextInt(2) + 1;
|
localHeight = 4;
|
||||||
loop: for (int i = 0; i < numPipes; i++) {
|
loop: for (int i = 0; i < numPipes; i++) {
|
||||||
space = (length + 2) <= maxLength;
|
space = (length + 2) <= maxLength;
|
||||||
|
|
||||||
if (space) {
|
if (space) {
|
||||||
while (Math.abs(localHeight - lastHeight) > 3) {
|
|
||||||
localHeight += localHeight > lastHeight ? -1 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastHeight = localHeight;
|
lastHeight = localHeight;
|
||||||
|
|
||||||
pipeHeight = localHeight > 5 ? 4 + random
|
pipeHeight = localHeight > 5 ? 4 + random
|
||||||
.nextInt(localHeight - 4) : 4;
|
.nextInt(localHeight - 4) : 4;
|
||||||
|
|
||||||
for (int y = 0; y < localHeight; y++) {
|
for (int y = height - localHeight; y < height; y++) {
|
||||||
setBlock(xo + length, this.height - 1 - y, Level.GROUND);
|
|
||||||
setBlock(xo + length + 1, this.height - 1 - y, Level.GROUND);
|
|
||||||
|
|
||||||
if (y == localHeight - 1) {
|
if (y == height - localHeight) {
|
||||||
setBlock(xo + length, this.height - 1 - y,
|
setBlock(xo + length, y, Level.TUBE_TOP_LEFT);
|
||||||
Level.TUBE_TOP_LEFT);
|
setBlock(xo + length + 1, y, Level.TUBE_TOP_RIGHT);
|
||||||
setBlock(xo + length + 1, this.height - 1 - y,
|
}
|
||||||
Level.TUBE_TOP_RIGHT);
|
|
||||||
|
else if (y - height - localHeight < pipeHeight) {
|
||||||
|
setBlock(xo + length, y, Level.TUBE_SIDE_LEFT);
|
||||||
|
setBlock(xo + length + 1, y, Level.TUBE_SIDE_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
setBlock(xo + length, y, Level.GROUND);
|
||||||
|
setBlock(xo + length + 1, y, Level.GROUND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldAddChallenge(PlayerProfile.ChallengeRewardType.ENEMY)) {
|
if (shouldAddChallenge(PlayerProfile.ChallengeRewardType.ENEMY)) {
|
||||||
setSpriteTemplate(xo + length, this.height - y,
|
setSpriteTemplate(xo + length, height - localHeight,
|
||||||
new SpriteTemplate(
|
new SpriteTemplate(SpriteTemplate.JUMP_FLOWER,
|
||||||
SpriteTemplate.JUMP_FLOWER, false));
|
false));
|
||||||
}
|
|
||||||
} else if (y > localHeight - pipeHeight) {
|
|
||||||
setBlock(xo + length, this.height - 1 - y,
|
|
||||||
Level.TUBE_SIDE_LEFT);
|
|
||||||
setBlock(xo + length + 1, this.height - 1 - y,
|
|
||||||
Level.TUBE_SIDE_RIGHT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
length += 2;
|
length += 2;
|
||||||
|
|
||||||
localHeight = random.nextInt(7) + 4;
|
localHeight = random.nextInt(7) + 4;
|
||||||
|
while (Math.abs(localHeight - lastHeight) > 3) {
|
||||||
|
localHeight += localHeight > lastHeight ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
midFloor = localHeight - (random.nextInt(4) + 1);
|
midFloor = localHeight - (random.nextInt(4) + 1);
|
||||||
if (midFloor <= 0) {
|
if (midFloor <= 0) {
|
||||||
midFloor = 1;
|
midFloor = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (gap = 0; gap < 4
|
for (gap = 0; gap <= 4
|
||||||
&& length + gap <= maxLength
|
&& length + gap <= maxLength
|
||||||
&& shouldAddChallenge(PlayerProfile.ChallengeRewardType.JUMP); gap++) {
|
&& shouldAddChallenge(PlayerProfile.ChallengeRewardType.JUMP); gap++) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user