- coin ani redesign
- Score balk - point animation units memorise color - Song title scalen in info Panel
This commit is contained in:
@@ -24,7 +24,9 @@ import model.objects.highscore.Highscore;
|
||||
import audio.Song;
|
||||
import audio.SongInstance;
|
||||
import audio.sorting.SortALPHA;
|
||||
import audio.sorting.SortAUTHOR;
|
||||
import audio.sorting.SortPLAYED;
|
||||
import audio.sorting.SortSCORE;
|
||||
import control.GameStateManager;
|
||||
import control.GameStateManager.State;
|
||||
import control.button.ButtonEvent;
|
||||
@@ -102,9 +104,12 @@ public class MenuState extends GameState {
|
||||
else
|
||||
{
|
||||
ButtonHandler.getButton(1).setColor(GameModel.colors[0]);
|
||||
ButtonHandler.getButton(2).setColor(GameModel.colors[3]);
|
||||
|
||||
ButtonHandler.getButton(5).setColor(GameModel.colors[1]);
|
||||
ButtonHandler.getButton(6).setColor(GameModel.colors[4]);
|
||||
ButtonHandler.getButton(3).setColor(GameModel.colors[1]);
|
||||
ButtonHandler.getButton(4).setColor(GameModel.colors[2]);
|
||||
ButtonHandler.getButton(5).setColor(GameModel.colors[4]);
|
||||
ButtonHandler.getButton(6).setColor(GameModel.colors[5]);
|
||||
JoystickHandler.REPEAT = true;
|
||||
}
|
||||
|
||||
@@ -187,19 +192,25 @@ public class MenuState extends GameState {
|
||||
subscreen = true;
|
||||
gsm.init();
|
||||
generateSubScreenForeground();
|
||||
}else if(e.getButton().getButtonID() == 5){
|
||||
sh.sort(new SortALPHA());
|
||||
selected = 0;
|
||||
sh.set(songs.indexOf(selectedToSong(selected)));
|
||||
sh.play();
|
||||
}else if(e.getButton().getButtonID() == 6){
|
||||
sh.sort(new SortPLAYED());
|
||||
selected = 0;
|
||||
sh.set(songs.indexOf(selectedToSong(selected)));
|
||||
sh.play();
|
||||
}else if(e.getButton().getButtonID() == 3){
|
||||
}else if(e.getButton().getButtonID() == 2){
|
||||
gsm.setState(control.GameStateManager.State.HELP_STATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(e.getButton().getButtonID() == 3){
|
||||
sh.sort(new SortALPHA());
|
||||
}else if(e.getButton().getButtonID() == 4){
|
||||
sh.sort(new SortAUTHOR());
|
||||
}else if(e.getButton().getButtonID() == 5){
|
||||
sh.sort(new SortPLAYED());
|
||||
}else if(e.getButton().getButtonID() == 6){
|
||||
sh.sort(new SortSCORE());
|
||||
}
|
||||
|
||||
selected = 0;
|
||||
sh.set(songs.indexOf(selectedToSong(selected)));
|
||||
sh.play();
|
||||
}
|
||||
}
|
||||
|
||||
if(e.getButton().getButtonID() == 0)
|
||||
@@ -334,23 +345,34 @@ public class MenuState extends GameState {
|
||||
|
||||
//select
|
||||
g2.setColor(GameModel.colors[0]);
|
||||
g2.fillOval(20, 860, 30, 30);
|
||||
g2.drawString("Play", 55, 880);
|
||||
g2.fillOval(20, 780, 30, 30);
|
||||
g2.drawString("Play", 55, 800);
|
||||
|
||||
//help
|
||||
g2.setColor(GameModel.colors[3]);
|
||||
g2.fillOval(20, 900, 30, 30);
|
||||
g2.drawString("Help", 55, 920);
|
||||
g2.fillOval(20, 820, 30, 30);
|
||||
g2.drawString("Help", 55, 840);
|
||||
|
||||
//letters
|
||||
g2.setColor(GameModel.colors[1]);
|
||||
g2.fillOval(20, 940, 30, 30);
|
||||
g2.drawString("A-Z", 55, 960);
|
||||
g2.fillOval(20, 860, 30, 30);
|
||||
g2.drawString("A-Z", 55, 880);
|
||||
|
||||
//most played
|
||||
g2.setColor(GameModel.colors[2]);
|
||||
g2.fillOval(20, 900, 30, 30);
|
||||
g2.drawString("Author", 55, 920);
|
||||
|
||||
//most played
|
||||
g2.setColor(GameModel.colors[4]);
|
||||
g2.fillOval(20, 940, 30, 30);
|
||||
g2.drawString("Most Played", 55, 960);
|
||||
|
||||
//most played
|
||||
g2.setColor(GameModel.colors[5]);
|
||||
g2.fillOval(20, 980, 30, 30);
|
||||
g2.drawString("Most Played", 55, 1000);
|
||||
g2.drawString("Highest Score", 55, 1000);
|
||||
|
||||
g2.dispose();
|
||||
|
||||
mainScreenBackground.createGraphics();
|
||||
|
||||
@@ -72,15 +72,12 @@ public class PlayState extends GameState {
|
||||
buttons_pressed = 0;
|
||||
joystick_moved = 0;
|
||||
|
||||
infoPanel.init(sql.getHighscore(sh.getCurrentSong(), sh.getCurrentSongInstance()).getScore());
|
||||
|
||||
for(Path p : area.paths)
|
||||
{
|
||||
p.getEnemysInPath().clear();
|
||||
}
|
||||
|
||||
for (int i = 1; i < ButtonHandler.getButtons().size(); i++) {
|
||||
Button b = ButtonHandler.getButton(i);
|
||||
b.setColor(Color.BLACK);
|
||||
}
|
||||
|
||||
ButtonHandler.getButton(1).setColor(sh.getCurrentSongInstance().getButtons().get(0).getColor());
|
||||
|
||||
@@ -160,7 +157,7 @@ public class PlayState extends GameState {
|
||||
}
|
||||
|
||||
private void endGame() {
|
||||
if(sh.getProgress()/1000 < 5000)
|
||||
if(sh.getProgress()/1000 > 5000)
|
||||
{
|
||||
sql.addPlaydata(sh.getCurrentSong(), sh.getCurrentSongInstance(), sh.getProgress()/1000, enemies_missed, enemies_hit, buttons_pressed, joystick_moved);
|
||||
sh.getCurrentSongInstance().played();
|
||||
@@ -194,19 +191,19 @@ public class PlayState extends GameState {
|
||||
player.draw(g2);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if(!Window.ON_RASP){
|
||||
int width,height;
|
||||
width = g2.getFontMetrics().stringWidth("");
|
||||
height = g2.getFontMetrics().getHeight();
|
||||
for (int i = 1; i < ButtonHandler.getButtons().size(); i++) {
|
||||
Ellipse2D oval = new Ellipse2D.Double(880+(50*i), 0, 50, 50);
|
||||
g2.setColor(ButtonHandler.getButton(i).getColor());
|
||||
g2.fill(oval);
|
||||
g2.setColor(Color.BLACK);
|
||||
width = g2.getFontMetrics().stringWidth(""+i);
|
||||
g2.drawString(""+i, (int)oval.getCenterX()-width/2,(int)oval.getMaxY()+height);
|
||||
}
|
||||
}
|
||||
// if(!Window.ON_RASP){
|
||||
// int width,height;
|
||||
// width = g2.getFontMetrics().stringWidth("");
|
||||
// height = g2.getFontMetrics().getHeight();
|
||||
// for (int i = 1; i < ButtonHandler.getButtons().size(); i++) {
|
||||
// Ellipse2D oval = new Ellipse2D.Double(880+(50*i), 0, 50, 50);
|
||||
// g2.setColor(ButtonHandler.getButton(i).getColor());
|
||||
// g2.fill(oval);
|
||||
// g2.setColor(Color.BLACK);
|
||||
// width = g2.getFontMetrics().stringWidth(""+i);
|
||||
// g2.drawString(""+i, (int)oval.getCenterX()-width/2,(int)oval.getMaxY()+height);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,10 +8,12 @@ import java.awt.GradientPaint;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Transparency;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.image.VolatileImage;
|
||||
|
||||
import control.button.ButtonHandler;
|
||||
import main.Window;
|
||||
import model.SongHandler;
|
||||
import model.drawObjects.CoinAnimation;
|
||||
import model.gameState.PlayState;
|
||||
|
||||
public class InfoPanel {
|
||||
@@ -21,10 +23,7 @@ public class InfoPanel {
|
||||
private VolatileImage infoPanel;
|
||||
private SongHandler sh;
|
||||
private String time;
|
||||
|
||||
private int tempComboMulitplier;
|
||||
|
||||
private CoinAnimation coinAnimation = new CoinAnimation(125, 300);
|
||||
private int highscore = 0;
|
||||
|
||||
public InfoPanel(int x, int y, SongHandler sh){
|
||||
this.x = x;
|
||||
@@ -33,16 +32,15 @@ public class InfoPanel {
|
||||
updateIPanel();
|
||||
generateInfoPanel();
|
||||
}
|
||||
|
||||
|
||||
public void init(int highscore)
|
||||
{
|
||||
this.highscore = highscore;
|
||||
updateIPanel();
|
||||
generateInfoPanel();
|
||||
}
|
||||
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);
|
||||
@@ -58,54 +56,81 @@ public class InfoPanel {
|
||||
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2.setRenderingHints(rh);
|
||||
|
||||
|
||||
// g2.setColor(Color.GRAY);
|
||||
GradientPaint gp = new GradientPaint(0, 0, new Color(245,245,245), 256, 1024, Color.WHITE);
|
||||
g2.setPaint(gp);
|
||||
g2.fillRect(x, y, 256, 1024);
|
||||
|
||||
g2.setColor(Color.BLACK);
|
||||
g2.drawRect(x, y, 255, 1023);
|
||||
|
||||
Font scoreFont = new Font("OCR A Extended", Font.BOLD, 30);
|
||||
g2.setFont(scoreFont);
|
||||
g2.setColor(Color.GREEN);
|
||||
g2.fillRect(25, 100, (int)(2 * PlayState.lifePoints), 30);
|
||||
g2.fillRect(25, 900, (int)(2 * PlayState.lifePoints), 30);
|
||||
|
||||
g2.setColor(Color.YELLOW);
|
||||
g2.fillRect(25, 950, (int)(2 * PlayState.comboScore), 30);
|
||||
|
||||
g2.setColor(Color.BLACK);
|
||||
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);
|
||||
g2.drawString(sh.getCurrentSongInstance().getDifficulty(), 25, 230);
|
||||
g2.drawString(sh.getCurrentSong().getAuthor(), 25, 260);
|
||||
g2.drawString(time, 25, 290);
|
||||
g2.drawRect(25, 900, 200, 30);
|
||||
g2.drawRect(25, 950, 200, 30);
|
||||
|
||||
// GradientPaint gp = new GradientPaint(300, 0, new Color(200,200,255), 256, 1024, Color.WHITE);
|
||||
// g2.setPaint(gp);
|
||||
// g2.fillRect(x, y, 256, 1024);
|
||||
|
||||
g2.setColor(Color.YELLOW);
|
||||
// Controlen of coin animatie nodig is
|
||||
if (!coinAnimation.areWeDoneYet()) {
|
||||
coinAnimation.draw(g2);
|
||||
// Score pas updaten wanneer coin in zijn laatste draw loop zit
|
||||
if (coinAnimation.isLastLoop())
|
||||
tempComboMulitplier = PlayState.comboScore;
|
||||
} else
|
||||
tempComboMulitplier = PlayState.comboScore;
|
||||
Font scoreFont = new Font("OCR A Extended", Font.BOLD, 35);
|
||||
g2.setFont(scoreFont);
|
||||
g2.drawString("Score: ", 25, 75);
|
||||
|
||||
Font scoreFont2 = new Font("OCR A Extended", Font.BOLD, 25);
|
||||
g2.setFont(scoreFont2);
|
||||
g2.drawString("Title: ", 25, 185);
|
||||
g2.drawString("Time: ", 25, 265);
|
||||
g2.drawString("Best: ", 25, 345);
|
||||
|
||||
|
||||
Font scoreFont3 = new Font("OCR A Extended", Font.BOLD, 35);
|
||||
g2.setFont(scoreFont3);
|
||||
g2.drawString("" + totalHighscore, 25, 105);
|
||||
g2.drawString(sh.getCurrentSong().getTitle(), 25, 215);
|
||||
g2.drawString(time, 25, 295);
|
||||
g2.drawString("" + highscore, 25, 375);
|
||||
|
||||
|
||||
g2.fillRect(25, 1000 - 7 * PlayState.comboScore, 200, 0 + 7 * PlayState.comboScore);
|
||||
if(!Window.ON_RASP){
|
||||
int width,height;
|
||||
width = g2.getFontMetrics().stringWidth("");
|
||||
height = g2.getFontMetrics().getHeight();
|
||||
|
||||
|
||||
Ellipse2D oval1 = new Ellipse2D.Double(25, 700, 50, 50);
|
||||
g2.setColor(ButtonHandler.getButton(1).getColor());
|
||||
g2.fill(oval1);
|
||||
|
||||
Ellipse2D oval2 = new Ellipse2D.Double(85, 700, 50, 50);
|
||||
g2.setColor(ButtonHandler.getButton(2).getColor());
|
||||
g2.fill(oval2);
|
||||
|
||||
Ellipse2D oval3 = new Ellipse2D.Double(145, 700, 50, 50);
|
||||
g2.setColor(ButtonHandler.getButton(3).getColor());
|
||||
g2.fill(oval3);
|
||||
|
||||
Ellipse2D oval4 = new Ellipse2D.Double(50, 760, 50, 50);
|
||||
g2.setColor(ButtonHandler.getButton(4).getColor());
|
||||
g2.fill(oval4);
|
||||
|
||||
Ellipse2D oval5 = new Ellipse2D.Double(110, 760, 50, 50);
|
||||
g2.setColor(ButtonHandler.getButton(5).getColor());
|
||||
g2.fill(oval5);
|
||||
|
||||
Ellipse2D oval6 = new Ellipse2D.Double(170, 760, 50, 50);
|
||||
g2.setColor(ButtonHandler.getButton(6).getColor());
|
||||
g2.fill(oval6);
|
||||
}
|
||||
|
||||
// g2.setColor(Color.BLACK);
|
||||
// width = g2.getFontMetrics().stringWidth(""+i);
|
||||
// g2.drawString(""+i, (int)oval.getCenterX()-width/2,(int)oval.getMaxY()+height);
|
||||
|
||||
|
||||
|
||||
|
||||
g2.dispose();
|
||||
infoPanel.createGraphics();
|
||||
}
|
||||
|
||||
public void throwACoin() {
|
||||
coinAnimation.start(); // Teller weer op 1 zetten
|
||||
}
|
||||
|
||||
|
||||
public void draw(Graphics2D g2){
|
||||
g2.drawImage(infoPanel, 0, 0, 256,1024,null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user