Skip to content

Commit

Permalink
Tweaked treasure and exit spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
antionio committed Nov 30, 2013
1 parent fb0304b commit 717dbec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@ private void spawnNewEnemiesAround(LabyrinthPiece piece,
}
}

final float randomX = currentPieceRelativePos.x + 1
+ MathUtils.random(9);
final float randomY = currentPieceRelativePos.y + 1
+ MathUtils.random(5);
final float randomX = currentPieceRelativePos.x + 2
+ MathUtils.random(7);
final float randomY = currentPieceRelativePos.y + 2
+ MathUtils.random(4);
if (template.treasureType != null) {
if (template.treasureType == Scroll.class && !player.gotScroll) {
entities.add(new Scroll(randomX, randomY, this));
Expand All @@ -408,7 +408,8 @@ private void spawnNewEnemiesAround(LabyrinthPiece piece,
}
}
if (template.hasExit) {
entities.add(new Exit(3, 1, this));
entities.add(new Exit(currentPieceRelativePos.x + 3,
currentPieceRelativePos.y + 1, this));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ private static boolean spawnTreasure(final LabyrinthPiece[][] labyrinth,
for (int x = 0; x < labyrinthWidth; x++) {
final int labyrinthHeight = labyrinth[0].length;
for (int y = 0; y < labyrinthHeight; y++) {
final LabyrinthPiece labyrinthPiece = labyrinth[x][y];
final int random = MathUtils.random(100);
if (random > 30 && random < 60) {
labyrinthPiece.roomTemplate.treasureType = treasureClass;
return true;
if (x != 0 && y != 0) {
final LabyrinthPiece labyrinthPiece = labyrinth[x][y];
final int random = MathUtils.random(100);
if (random > 30 && random < 60) {
labyrinthPiece.roomTemplate.treasureType = treasureClass;
return true;
}
}
}
}
Expand Down

0 comments on commit 717dbec

Please sign in to comment.