- mooiere afdaling.
- scorebar vult pas nadat muntje 'erin valt'
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
package model.drawObjects;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by Bilel on 4-6-2015.
|
||||
@@ -24,6 +20,7 @@ public class CoinAnimation extends DrawObject {
|
||||
coinShape = new Ellipse2D.Double(startX, startY, 20, 20);
|
||||
}
|
||||
|
||||
// Start
|
||||
public void start() {
|
||||
timerLoops = 1;
|
||||
}
|
||||
@@ -34,7 +31,6 @@ public class CoinAnimation extends DrawObject {
|
||||
g2.draw(coinShape); // MUNTJE TEKENEN
|
||||
g2.fill(coinShape);
|
||||
update(timerLoops); // UPDATE
|
||||
|
||||
}
|
||||
|
||||
// Wordt na elke paint aangeroepen
|
||||
@@ -45,20 +41,25 @@ public class CoinAnimation extends DrawObject {
|
||||
return;
|
||||
}
|
||||
|
||||
// Frame steeds aanpassen aan locatie van coin (Zodat hele coin wel te zien blijft)
|
||||
// Coin omlaag verschuiven doordat Y * loops omlaag gaat
|
||||
coinShape.setFrame(coinSetPoint.getX(), coinSetPoint.getY() + 10 * timerLoops,
|
||||
coinShape.getWidth(), coinShape.getHeight());
|
||||
|
||||
timerLoops++;
|
||||
|
||||
}
|
||||
|
||||
// Zijn we al begonnen/klaar?
|
||||
public boolean areWeDoneYet() {
|
||||
System.out.println(timerLoops);
|
||||
if (timerLoops > 50 || timerLoops == 0) {
|
||||
timerLoops = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLastLoop() {
|
||||
if (timerLoops == 49)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,7 @@ public class GameOverState extends GameState {
|
||||
BufferedImage gameOver = Images.getImage(ImageType.gameover);
|
||||
VolatileImage background;
|
||||
Font textFont = new Font("OCR A Extended", Font.BOLD, 70);
|
||||
|
||||
|
||||
|
||||
private String endScore = "";
|
||||
|
||||
int frame;
|
||||
|
||||
@@ -21,7 +21,9 @@ public class InfoPanel {
|
||||
private SongHandler sh;
|
||||
private String time;
|
||||
|
||||
private CoinAnimation coinAnimation = new CoinAnimation(125, 200);
|
||||
private int tempComboScore;
|
||||
|
||||
private CoinAnimation coinAnimation = new CoinAnimation(125, 250);
|
||||
|
||||
public InfoPanel(int x, int y, SongHandler sh){
|
||||
this.x = x;
|
||||
@@ -68,25 +70,28 @@ public class InfoPanel {
|
||||
g2.drawString("Score: " + totalHighscore, 25, 75);
|
||||
g2.drawRect(25, 100, 200, 30);
|
||||
g2.drawRect(25, 300, 200, 700);
|
||||
|
||||
g2.drawString(sh.getCurrentSong().getTitle(), 25, 200);
|
||||
if(sh.getCurrentSong().getSubtitle() != "")
|
||||
{
|
||||
|
||||
if(sh.getCurrentSong().getSubtitle() != "") {
|
||||
g2.drawString(sh.getCurrentSong().getSubtitle(), 25, 230);
|
||||
g2.drawString(sh.getCurrentSong().getAuthor(), 25, 260);
|
||||
g2.drawString(time, 25, 290);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
g2.drawString(sh.getCurrentSong().getAuthor(), 25, 230);
|
||||
g2.drawString(time, 25, 260);
|
||||
}
|
||||
|
||||
if (!coinAnimation.areWeDoneYet())
|
||||
if (!coinAnimation.areWeDoneYet()) {
|
||||
coinAnimation.draw(g2);
|
||||
|
||||
if (coinAnimation.isLastLoop())
|
||||
tempComboScore = PlayState.comboScore;
|
||||
}
|
||||
|
||||
g2.fillRect(25, 1000 - 7 * tempComboScore, 200, 7 * tempComboScore);
|
||||
g2.setColor(Color.YELLOW);
|
||||
g2.fillRect(25, 1000 - 7 * PlayState.comboScore, 200, 0 + 7 * PlayState.comboScore);
|
||||
|
||||
g2.dispose();
|
||||
infoPanel.createGraphics();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user