diff --git a/src/main/Game.java b/src/main/Game.java index e97ec19..ef3caf3 100644 --- a/src/main/Game.java +++ b/src/main/Game.java @@ -75,6 +75,7 @@ public class Game extends Canvas implements Runnable{ private Controller c; private Skins tp; private Menu menu; + private ShowScore showscore; public static int numberOfPlayers = 2; public static boolean padraicmode = false; @@ -107,6 +108,7 @@ public class Game extends Canvas implements Runnable{ tp = new Skins(this); c = new Controller(tp, this); menu = new Menu(); + showscore = new ShowScore(this); if(numberOfPlayers == 2){ p2 = new Player2(300, 300, tp, this, c); @@ -286,7 +288,8 @@ public class Game extends Canvas implements Runnable{ level = 0; }else if(State == STATE.END){ g.drawImage(gameOver,0,0, null); - if(delay == 10000){ + showscore.render(g); + if(delay == 1000){ State = STATE.MENU; } delay++; diff --git a/src/main/MouseInput.java b/src/main/MouseInput.java index 9a314d0..6baf483 100644 --- a/src/main/MouseInput.java +++ b/src/main/MouseInput.java @@ -31,13 +31,11 @@ public class MouseInput implements MouseListener{ if(mx >= 265 && mx <= 535 && my >= 225 && my <= 275) { Game.numberOfPlayers = 1; - Game.padraicmode = false; Game.State = Game.STATE.GAME; } else if(mx >= 285 && mx <= 515 && my >= 325 && my <= 375) { Game.numberOfPlayers = 2; - Game.padraicmode = false; Game.State = Game.STATE.GAME; } else if(mx >= 365 && mx <= 435 && my >= 425 && my <= 475) @@ -46,16 +44,9 @@ public class MouseInput implements MouseListener{ } else if(mx >= 610 && mx <= 650 && my >= 540 && my <= 580) { - Game.numberOfPlayers = 1; - Game.padraicmode = true; - Game.State = Game.STATE.GAME; - } - else if(mx >= 0 && mx <= 40 && my >= 0 && my <= 40) - { - Game.numberOfPlayers = 2; - Game.padraicmode = true; - Game.State = Game.STATE.GAME; + Game.padraicmode = !Game.padraicmode; } + } } diff --git a/src/main/ShowScore.java b/src/main/ShowScore.java new file mode 100644 index 0000000..8bad1b1 --- /dev/null +++ b/src/main/ShowScore.java @@ -0,0 +1,31 @@ +package main; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Font; + +public class ShowScore { + private Game game; + private int shift = 0; + + public ShowScore(Game game){ + this.game = game; + } + public void render(Graphics g){ + Font title_font = new Font("comic sans ms", Font.BOLD, 100); + g.setFont(title_font); + g.setColor(Color.white); + if(game.getScore()>= 100){ + shift = -50; + } + if(game.getScore() >= 1000){ + shift = -75; + } + if(game.getScore() >= 10000){ + shift = -100; + } + g.drawString("SCORE: " + Integer.toString(game.getScore()), 145+shift, 450); + + + } + +} \ No newline at end of file