Verbetercode.

This commit is contained in:
Bilel Bghiel
2015-06-16 17:30:34 +02:00
parent 7507d0fd63
commit 1f44b5b487
4 changed files with 148 additions and 49 deletions
+20 -4
View File
@@ -10,6 +10,7 @@ import java.awt.Transparency;
import java.awt.image.VolatileImage;
import model.SongHandler;
import model.drawObjects.CoinAnimation;
import model.gameState.PlayState;
public class InfoPanel {
@@ -19,6 +20,9 @@ public class InfoPanel {
private VolatileImage infoPanel;
private SongHandler sh;
private String time;
private CoinAnimation coinAnimation = new CoinAnimation(125, 300);
private int tempComboScore;
public InfoPanel(int x, int y, SongHandler sh){
this.x = x;
@@ -66,15 +70,27 @@ public class InfoPanel {
g2.drawRect(25, 300, 200, 700);
g2.drawString(sh.getCurrentSong().getTitle(), 25, 200);
g2.drawString(sh.getCurrentSongInstance().getDifficulty(), 25, 230);
g2.drawString(sh.getCurrentSong().getAuthor(), 25, 260);
g2.drawString(time, 25, 290);
g2.drawString(sh.getCurrentSongInstance().getDifficulty(), 25, 230);
g2.drawString(sh.getCurrentSong().getAuthor(), 25, 260);
g2.drawString(time, 25, 290);
if (!coinAnimation.areWeDoneYet()) {
coinAnimation.draw(g2);
// Score pas updaten wanneer coin klaar is met afspelen
if (coinAnimation.isLastLoop())
tempComboScore = PlayState.comboScore;
} else
tempComboScore = PlayState.comboScore;
g2.setColor(Color.YELLOW);
g2.fillRect(25, 1000 - 7 * PlayState.comboScore, 200, 0 + 7 * PlayState.comboScore);
g2.fillRect(25, 1000 - 7 * tempComboScore, 200, 7 * tempComboScore);
g2.dispose();
infoPanel.createGraphics();
}
public void throwACoin() {
coinAnimation.start(); // Teller weer op 0 zetten
}
public void draw(Graphics2D g2){
g2.drawImage(infoPanel, 0, 0, 256,1024,null);