removed unnecessary code
This commit is contained in:
@@ -7,7 +7,6 @@ import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class Sound {
|
||||
|
||||
@@ -32,7 +31,7 @@ public class Sound {
|
||||
clip = AudioSystem.getClip();
|
||||
clip.open(ais);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Boot.logger.log(Level.SEVERE, "Could not load Sound File: " + soundURL[i], e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
package de.miaurizius.jgame2d.core;
|
||||
|
||||
import java.awt.*;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class UI {
|
||||
|
||||
GamePanel panel;
|
||||
Graphics graphics2d;
|
||||
Font arial_40, arial_80B;
|
||||
DecimalFormat df = new DecimalFormat("#0.00");
|
||||
|
||||
public boolean messageOn = false;
|
||||
public String message;
|
||||
public boolean gameFinished = false;
|
||||
|
||||
int msgC = 0;
|
||||
double playTime;
|
||||
|
||||
public UI(GamePanel panel) {
|
||||
this.panel = panel;
|
||||
@@ -23,11 +14,6 @@ public class UI {
|
||||
arial_80B = new Font("Arial", Font.BOLD, 80);
|
||||
}
|
||||
|
||||
public void showMessage(String text) {
|
||||
message = text;
|
||||
messageOn = true;
|
||||
}
|
||||
|
||||
public void draw(Graphics graphics2d) {
|
||||
this.graphics2d = graphics2d;
|
||||
graphics2d.setFont(arial_40);
|
||||
@@ -44,6 +30,7 @@ public class UI {
|
||||
}
|
||||
|
||||
public void drawPauseScreen() {
|
||||
graphics2d.setFont(graphics2d.getFont().deriveFont(Font.PLAIN, 80));
|
||||
String text = "PAUSED";
|
||||
int y = panel.screenHeight / 2;
|
||||
graphics2d.drawString(text, getCenteredX(text), y);
|
||||
|
||||
@@ -15,7 +15,6 @@ public class Player extends Entity {
|
||||
|
||||
public final int screenX;
|
||||
public final int screenY;
|
||||
public int hasKey = 0;
|
||||
|
||||
public Player(GamePanel panel, KeyHandler keyH) {
|
||||
this.panel = panel;
|
||||
@@ -97,34 +96,7 @@ public class Player extends Entity {
|
||||
|
||||
public void pickObject(int index) {
|
||||
if(index == 999) return;
|
||||
switch(panel.obj[index].name.toLowerCase()) {
|
||||
case "key":
|
||||
panel.playSE(1);
|
||||
hasKey++;
|
||||
panel.obj[index] = null;
|
||||
panel.ui.showMessage("You got a key!");
|
||||
break;
|
||||
case "door":
|
||||
if(hasKey > 0) {
|
||||
panel.playSE(3);
|
||||
panel.obj[index] = null;
|
||||
hasKey--;
|
||||
panel.ui.showMessage("You opened the door!");
|
||||
}
|
||||
else panel.ui.showMessage("You need a key!");
|
||||
break;
|
||||
case "boots":
|
||||
panel.playSE(2);
|
||||
speed += 1;
|
||||
panel.obj[index] = null;
|
||||
panel.ui.showMessage("Speed up!");
|
||||
break;
|
||||
case "chest":
|
||||
panel.ui.gameFinished = true;
|
||||
panel.stopMusic();
|
||||
panel.playSE(4);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void draw(Graphics2D graphics2d) {
|
||||
|
||||
Reference in New Issue
Block a user