Skip to content

Commit

Permalink
Last minute changes, including showing the score, changing how secret
Browse files Browse the repository at this point in the history
mode works, and fixed some bugs
  • Loading branch information
jdm13003 committed Apr 27, 2016
1 parent f0529ac commit a0be164
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
5 changes: 4 additions & 1 deletion src/main/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public static enum STATE {
private Controller c;
private Skins tp;
private Menu menu;
private ShowScore showscore;
public static int numberOfPlayers = 2;
public static boolean padraicmode = false;

Expand Down Expand Up @@ -107,6 +108,7 @@ public void init()
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);
Expand Down Expand Up @@ -286,7 +288,8 @@ private void render(){
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++;
Expand Down
13 changes: 2 additions & 11 deletions src/main/MouseInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ public void mousePressed(MouseEvent e) {
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)
Expand All @@ -46,16 +44,9 @@ else if(mx >= 365 && mx <= 435 && my >= 425 && my <= 475)
}
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;
}

}

}
Expand Down
31 changes: 31 additions & 0 deletions src/main/ShowScore.java
Original file line number Diff line number Diff line change
@@ -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);


}

}

0 comments on commit a0be164

Please sign in to comment.