- Duidelijkere score (punten beloning * multiplier)

- Score animatie bij het balletje waar je punten mee scoort
This commit is contained in:
Bilel Bghiel
2015-06-20 13:24:23 +02:00
parent 412ed60dfe
commit 11811ef6af
4 changed files with 34 additions and 30 deletions
+10 -15
View File
@@ -3,10 +3,12 @@ package model.objects;
import image.Images;
import java.awt.*;
import java.awt.geom.Point2D;
import java.awt.image.VolatileImage;
import model.SongHandler;
import model.drawObjects.CoinAnimation;
import model.drawObjects.PointAnimation;
import model.gameState.PlayState;
public class InfoPanel {
@@ -21,7 +23,7 @@ public class InfoPanel {
private CoinAnimation coinAnimation = new CoinAnimation(125, 300);
public InfoPanel(int x, int y, SongHandler sh){
this.x = x;
this.y = y;
@@ -32,13 +34,6 @@ public class InfoPanel {
public void updateIPanel() {
totalHighscore = "" + PlayState.currentScore;
// time = "";
// long progress = (sh.getProgress() / 1000);
// time = progress%1000 + time;
// progress /= 1000;
// time = progress%1000 + ":" + time;
// progress /= 1000;
// time = progress + ":" + time;
long progress = (sh.getProgress() / 1000);
String millis = ((progress) % 1000) + "".length() > 3 ? ("" +((progress) % 1000)).substring(0, 2) : "" + ((progress) % 1000);
@@ -70,10 +65,10 @@ public class InfoPanel {
g2.fillRect(25, 100, (int)(2 * PlayState.lifePoints), 30);
// Laatste punten in-/decrease tonen.
if (PlayState.sinceScoreChanged < 75 && PlayState.sinceScoreChanged != 0) {
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float)(1 - (PlayState.sinceScoreChanged * 0.01))));
if (PlayState.sinceScoreChanged < 60 && PlayState.sinceScoreChanged != 0) {
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float)(1 - (PlayState.sinceScoreChanged * 0.015))));
g2.setColor(Color.RED);
g2.drawString("+" + PlayState.lastScoreChange, 205, 40);
g2.drawString("+" + PlayState.lastScoreChange, 185, 40);
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
}
@@ -94,16 +89,16 @@ public class InfoPanel {
coinAnimation.draw(g2);
// Score pas updaten wanneer coin in zijn laatste draw loop zit
if (coinAnimation.isLastLoop())
tempComboScore = PlayState.comboScore;
tempComboScore = PlayState.currentScore;
} else
tempComboScore = PlayState.comboScore;
tempComboScore = PlayState.currentScore;
g2.drawString(sh.getCurrentSongInstance().getDifficulty(), 25, 230);
g2.drawString(sh.getCurrentSong().getAuthor(), 25, 260);
g2.drawString(time, 25, 290);
g2.setColor(Color.YELLOW);
g2.fillRect(25, 1000 - 7 * tempComboScore, 200, 7 * tempComboScore);
g2.fillRect(25, (int)(1000 - PlayState.comboMulitplier * 35), 200, 35 * ((int)PlayState.comboMulitplier));
g2.dispose();
infoPanel.createGraphics();
}
@@ -111,7 +106,7 @@ public class InfoPanel {
public void throwACoin() {
coinAnimation.start(); // Teller weer op 1 zetten
}
public void draw(Graphics2D g2){
g2.drawImage(infoPanel, 0, 0, 256,1024,null);
}
+9
View File
@@ -12,12 +12,14 @@ import java.awt.Stroke;
import java.awt.Transparency;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.VolatileImage;
import java.util.ArrayList;
import java.util.List;
import model.drawObjects.Enemy;
import model.drawObjects.PointAnimation;
import model.gameState.PlayState;
public class PlayArea {
@@ -32,6 +34,8 @@ public class PlayArea {
maxCount = 100,
pathID = -1,
oldPathId = pathID;
private PointAnimation pointAnimation = new PointAnimation();
private Stroke stroke = new BasicStroke(5);
private Rectangle2D backgroundPlay = new Rectangle2D.Double(256, 0, 1024, 1024);
@@ -109,6 +113,9 @@ public class PlayArea {
generateBackground();
oldPathId = pathID;
}
pointAnimation.draw(g2);
}
public Line2D getLine(int index){
@@ -172,4 +179,6 @@ public class PlayArea {
g2.dispose();
background.createGraphics();
}
public void enemyDied(Point2D.Double p) { pointAnimation.enemyDied(p); }
}