Skip to content

Commit

Permalink
Fixed shops, coins and enemies generation logic when setup
Browse files Browse the repository at this point in the history
  • Loading branch information
fg23262 authored Apr 18, 2024
1 parent c7eba12 commit 3050133
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Code/src/main/java/org/example/GameLoop.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ public void setup(){

//generate walls
Obstacle.walls = Wall.generateWalls(rows, cols, this);
//generate shops
Obstacle.shops = Shop.generateShops(rows, cols, this);
//generate coins
Coin.setCoinsInEmptySpaces(this);
if (PVE) {
//generate shops
Obstacle.shops = Shop.generateShops(rows, cols, this);
//generate coins
Coin.setCoinsInEmptySpaces(this);
}
//generate rocks
Obstacle.rocks = BreakableRock.generateRocks(rows,cols, this, 0.5f);
Obstacle.lessRocks = BreakableRock.generateLessRocks(rows,cols, this, 0.3f);
Expand All @@ -42,9 +44,9 @@ public void setup(){

Obstacle.initializeObstacleGrid();
Obstacle.initializeObstacleGridPVP();

Character.enemies = Enemy.generateEnemies(this);

if (PVE) {
Character.enemies = Enemy.generateEnemies(this);
}
Character.players = Player.setPlayer1(this);
Character.players = Player.setPlayer2(this);

Expand Down Expand Up @@ -461,4 +463,4 @@ private static void gameEndDetectPVP() {
//System.out.println("Player 1 won!");
}
}
}
}

0 comments on commit 3050133

Please sign in to comment.