Browse Source

added new orange fruit

remotes/origin/player
fdai7910 11 months ago
parent
commit
6a7147d683
  1. 8
      src/main/java/pacmanGame/Cell.java
  2. 2
      src/main/java/pacmanGame/GameManager.java
  3. 1
      src/main/java/pacmanGame/VisualizerPlainText.java

8
src/main/java/pacmanGame/Cell.java

@ -35,6 +35,11 @@ public class Cell {
map.gameManager.score += 405;
}
public void triggerOrange() {
this.type = "empty";
map.gameManager.score += 305;
}
public void triggerItem() {
if(type.equals("dot")) {
triggerDot();
@ -48,6 +53,9 @@ public class Cell {
else if(type.equals("strawberry")) {
triggerStrawberry();
}
else if(type.equals("orange")) {
triggerStrawberry();
}
else {
//System.out.println("cell contains no item!");
}

2
src/main/java/pacmanGame/GameManager.java

@ -52,7 +52,7 @@ public class GameManager {
}
public String randomFruit() {
String fruitTypes[] = {"cherry","strawberry"};
String fruitTypes[] = {"cherry","strawberry","orange"};
int randomNumber = (int) (Math. random() * (fruitTypes.length));
return fruitTypes[randomNumber];
}

1
src/main/java/pacmanGame/VisualizerPlainText.java

@ -14,6 +14,7 @@ public class VisualizerPlainText implements Visualizer {
this.put("wall", "[]");
this.put("cherry", "OO");
this.put("strawberry", "T7");
this.put("orange", "CO");
}};
public final String ghostSprite = "AA";

Loading…
Cancel
Save