Skip to content

Commit

Permalink
Added Gave Over message and reset internal clock to 250
Browse files Browse the repository at this point in the history
  • Loading branch information
pkrinsky294 committed Dec 13, 2020
1 parent 3e3a59b commit 414a4ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion pacman/src/main/java/pacman/graphics/PacmanGraphics.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class PacmanGraphics extends Canvas{
public static final int HEIGHT = ROWS * BLOCK_SIZE;
public static final int WIDTH = COLS * BLOCK_SIZE;

public static final double TICK_TIME_MS = 50;
public static final double TICK_TIME_MS = 250;

private int score = 0;
private int ticks = 0;
Expand Down Expand Up @@ -316,6 +316,9 @@ public void drawField(RobotBase robot) {
// Drawing the rotated image at the required drawing locations
g.drawImage(op.filter(robotImage, null), toPosition(RobotBase.driveTrain.getPositionX()), toPosition(RobotBase.driveTrain.getPositionY()), null);

} else {
g.setColor(Color.red);
g.drawString("GAME OVER",25,50);
}

g.setColor(Color.white);
Expand Down
8 changes: 4 additions & 4 deletions pacman/src/main/java/pacman/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

public class Robot extends RobotBase {

public static long RUN_NORMAL = 50;
public static long RUN_FAST = 10;
public static long RUN_SLOW = 250;
public static long RUN_NORMAL = 250;
public static long RUN_FAST = 50;
public static long RUN_SLOW = 500;

public static void main(String[] args) {

Expand All @@ -19,7 +19,7 @@ public static void main(String[] args) {
Robot robot = new Robot();

// run the command group
robotRunner.run(robot, new AutoGroup(), RUN_SLOW,2);
robotRunner.run(robot, new AutoGroup(), RUN_NORMAL,2);

}

Expand Down

0 comments on commit 414a4ca

Please sign in to comment.