Skip to content

Commit

Permalink
Javadoc updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Phhere committed Jul 3, 2012
1 parent 317a3c4 commit d2e8bd5
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 29 deletions.
2 changes: 1 addition & 1 deletion javadoc.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="javadoc">
<target name="javadoc">
<javadoc access="private" author="true" classpath="C:\Program Files\eclipse\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;C:\Program Files\eclipse\plugins\org.junit_4.8.2.v4_8_2_v20110321-1705\junit.jar" destdir="doc" doctitle="Bomberman Dokumentation" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="entities,level,graphics,game,network" source="1.6" sourcefiles="tests/ImageTest.java,tests/SpriteTest.java,tests/NetworkTest.java" sourcepath="tests;src" splitindex="true" use="true" version="true"/>
<javadoc access="public" author="true" classpath="H:\Java\Eclipse\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;H:\Java\Eclipse\plugins\org.junit_4.8.2.v4_8_2_v20110321-1705\junit.jar" destdir="doc" doctitle="Bomberman" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="input,level,gui,game.highscore,entities,graphics,sound,game,network,entities.items,enums" source="1.6" sourcepath="src" splitindex="true" use="true" version="true"/>
</target>
</project>
5 changes: 5 additions & 0 deletions src/entities/Bomb.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public Bomb(int x, int y, Player owner) {
this.sound = Soundmanager.getInstance().load("Explosion.wav", false);
}

/**
* Alternate Constructor for Multiplayer
*
* @see Bomb
*/
public Bomb(int x, int y, int playerID) {
this(x, y, (Player) Game.players.get(playerID));
}
Expand Down
9 changes: 9 additions & 0 deletions src/entities/BombAnimation.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public class BombAnimation extends Entity {
*/
public Player owner;

/**
* Array with elements which are placed after explosion
*/
private ArrayList<Entity> toPlace = new ArrayList<Entity>();

/**
Expand Down Expand Up @@ -226,6 +229,12 @@ public void collide(Entity e) {
}
}

/**
* Adds an entity to be placed after explosion
*
* @param e
* Entity
*/
public void addAfterExplosion(Entity e) {
this.toPlace.add(e);
}
Expand Down
14 changes: 14 additions & 0 deletions src/entities/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,25 @@ public void setKeys(KeySettings keys) {
this.keys = keys;
}

/**
* Set the position of the player Used for network gaming
*
* @param x
* int
* @param y
* int
*/
public void setPosition(int x, int y) {
this.x = x;
this.y = y;
}

/**
* Gets called when a player died
*
* @param by
* Entity
*/
public void killed(Entity by) {
for (int i = 0; i < Game.players.size(); i++) {
Player livingPlayer = (Player) Game.players.get(i);
Expand Down
5 changes: 5 additions & 0 deletions src/entities/Trap.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public void draw(Graphics g) {
g.drawImage((this.images[0][0]).image, this.x, this.y, Game.BLOCK_SIZE, Game.BLOCK_SIZE, null);
}

/*
* (non-Javadoc)
*
* @see entities.Entity#collide(entities.Entity)
*/
@Override
public void collide(Entity e) {
if (e instanceof Player) {
Expand Down
7 changes: 4 additions & 3 deletions src/entities/Wall.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ public Wall(int x, int y) {

}

/**
* draws Wall on canvas
/*
* (non-Javadoc)
*
* @see entities.Entity#draw(java.awt.Graphics)
*/

@Override
public void draw(Graphics g) {
g.setColor(Color.RED);
Expand Down
13 changes: 11 additions & 2 deletions src/entities/items/Falle.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public void remove(Player p) {

}

/*
* (non-Javadoc)
*
* @see entities.items.Item#action(entities.Player)
*/
@Override
public void action(Player p) {
int b_x = Box.fitToBlock(p.x);
Expand All @@ -36,10 +41,14 @@ public void action(Player p) {
p.item = null;
}

/*
* (non-Javadoc)
*
* @see entities.Entity#draw(java.awt.Graphics)
*/
@Override
public void draw(Graphics g) {
g.drawImage((this.images[0][0]).image, this.x, this.y, Game.BLOCK_SIZE,
Game.BLOCK_SIZE, null);
g.drawImage((this.images[0][0]).image, this.x, this.y, Game.BLOCK_SIZE, Game.BLOCK_SIZE, null);
}

}
21 changes: 21 additions & 0 deletions src/entities/items/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,36 @@

public abstract class Item extends Entity {

/**
* Default Constructor for alle Items
*
* @param x
* @param y
*/
public Item(int x, int y) {
super(x, y);
this.needsStep = false;
}

/**
* Gets called when a player gets the item
*
* @param p
*/
public abstract void use(Player p);

/**
* Gets called when a player gets another item
*
* @param p
*/
public abstract void remove(Player p);

/**
* Gets called then the player presses "k"
*
* @param p
*/
public abstract void action(Player p);

}
18 changes: 16 additions & 2 deletions src/entities/items/Schuh.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@ public Schuh(int x, int y) {
this.images = Sprite.load("items/speed_n.png", 48, 48);
}

/*
* (non-Javadoc)
*
* @see entities.items.Item#use(entities.Player)
*/
@Override
public void use(Player p) {
p.speed *= 1.2;
}

/*
* (non-Javadoc)
*
* @see entities.items.Item#remove(entities.Player)
*/
@Override
public void remove(Player p) {
p.speed /= 1.2;
Expand All @@ -30,10 +40,14 @@ public void remove(Player p) {
*/
@Override
public void draw(Graphics g) {
g.drawImage((this.images[0][0]).image, this.x, this.y, Game.BLOCK_SIZE,
Game.BLOCK_SIZE, null);
g.drawImage((this.images[0][0]).image, this.x, this.y, Game.BLOCK_SIZE, Game.BLOCK_SIZE, null);
}

/*
* (non-Javadoc)
*
* @see entities.items.Item#action(entities.Player)
*/
@Override
public void action(Player p) {
// TODO Auto-generated method stub
Expand Down
18 changes: 16 additions & 2 deletions src/entities/items/SlowDown.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@ public SlowDown(int x, int y) {
this.images = Sprite.load("items/freeze.png", 48, 48);
}

/*
* (non-Javadoc)
*
* @see entities.items.Item#use(entities.Player)
*/
@Override
public void use(Player p) {
p.speed /= 1.2;
}

/*
* (non-Javadoc)
*
* @see entities.items.Item#remove(entities.Player)
*/
@Override
public void remove(Player p) {
p.speed *= 1.2;
Expand All @@ -30,10 +40,14 @@ public void remove(Player p) {
*/
@Override
public void draw(Graphics g) {
g.drawImage((this.images[0][0]).image, this.x, this.y, Game.BLOCK_SIZE,
Game.BLOCK_SIZE, null);
g.drawImage((this.images[0][0]).image, this.x, this.y, Game.BLOCK_SIZE, Game.BLOCK_SIZE, null);
}

/*
* (non-Javadoc)
*
* @see entities.items.Item#action(entities.Player)
*/
@Override
public void action(Player p) {
// TODO Auto-generated method stub
Expand Down
50 changes: 34 additions & 16 deletions src/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public class Game extends Canvas {
*/
public static final int BLOCK_SIZE = 50;

/**
* Current Gamemode
*
* @see Gamemode
*/
public static Gamemode gamemode = null;

/**
Expand Down Expand Up @@ -116,15 +121,24 @@ public class Game extends Canvas {
*/
private int oldBackgroundElems = 0;

/**
* Holds the NetworkManager when Multiplayer
*/
public static NetworkManager network;

/**
* Highscore manager
*/
public HighscoreManager hm = new HighscoreManager();

/**
* String of the current Map Used for restart
*/
private String map;

/**
* Parent Element of the Gamecanvas,used on resize
*/
private Container frame;

/**
Expand Down Expand Up @@ -163,8 +177,7 @@ private Game() {
this.requestFocus();
this.setFocusable(true);
this.init();
Sound backgroundSound = Soundmanager.getInstance().load(
"rick_roll.wav", true);
Sound backgroundSound = Soundmanager.getInstance().load("rick_roll.wav", true);
backgroundSound.play();
}

Expand Down Expand Up @@ -289,8 +302,7 @@ private void draw(Graphics g) {

if (this.oldBackgroundElems != Game.staticBackground.size()) {

Game.background = new BufferedImage(Game.GAME_WIDTH,
Game.GAME_HEIGHT, BufferedImage.TYPE_INT_ARGB);
Game.background = new BufferedImage(Game.GAME_WIDTH, Game.GAME_HEIGHT, BufferedImage.TYPE_INT_ARGB);
for (Entity e : Game.staticBackground) {
e.draw(Game.background.getGraphics());
}
Expand All @@ -315,9 +327,7 @@ private void draw(Graphics g) {

for (int i = 0; i < Game.players.size(); i++) {
Player drawPoints = (Player) Game.players.get(i);
g.drawString(
"Spieler " + (i + 1) + ":" + drawPoints.pm.getPoints(),
100 * (i + 1), 10);
g.drawString("Spieler " + (i + 1) + ":" + drawPoints.pm.getPoints(), 100 * (i + 1), 10);
}

g.drawString("FPS: " + this.fps_static, 0, 10);
Expand Down Expand Up @@ -359,8 +369,7 @@ public void gameEnd(Player p, Gameend type) {
if (type == Gameend.finishReached) {
question = new JOptionPane("Du hast gewonnen!");
} else if (type == Gameend.lastAlive) {
question = new JOptionPane(
"Alle anderen Spieler sind tot. Du hast gewonnen.");
question = new JOptionPane("Alle anderen Spieler sind tot. Du hast gewonnen.");
} else {
question = new JOptionPane("Du hast verloren.");
}
Expand All @@ -375,8 +384,7 @@ public void gameEnd(Player p, Gameend type) {
index = Game.players.indexOf(p) + 1;
String winner;
if (type == Gameend.finishReached) {
JOptionPane.showMessageDialog(this, "Spieler " + index
+ " ist im Ziel und hat gewonnen!");
JOptionPane.showMessageDialog(this, "Spieler " + index + " ist im Ziel und hat gewonnen!");
winner = JOptionPane
.showInputDialog(
this,
Expand All @@ -395,9 +403,8 @@ public void gameEnd(Player p, Gameend type) {
} else {
otherplayer = 1;
}
JOptionPane.showMessageDialog(this, "Spieler " + index
+ " ist tot. Somit hat Spieler " + otherplayer
+ " gewonnen.");
JOptionPane.showMessageDialog(this, "Spieler " + index + " ist tot. Somit hat Spieler "
+ otherplayer + " gewonnen.");
winner = JOptionPane
.showInputDialog(
this,
Expand All @@ -416,8 +423,7 @@ public void gameEnd(Player p, Gameend type) {
JOptionPane.showMessageDialog(this, "Du hast verloren!");
}
}
int choice = JOptionPane.showConfirmDialog(this,
"M\u00F6chten Sie das Spiel neustarten ?", "Spielende",
int choice = JOptionPane.showConfirmDialog(this, "M\u00F6chten Sie das Spiel neustarten ?", "Spielende",
JOptionPane.YES_NO_OPTION);

if (choice == 0) {
Expand Down Expand Up @@ -489,6 +495,12 @@ public void repack() {
}
}

/**
* Return the array with just unique elements
*
* @param entities2
* @return List<Entity>
*/
public static List<Entity> unique(List<Entity> entities2) {
HashSet<Entity> hs = new HashSet<Entity>();
hs.addAll(entities2);
Expand All @@ -498,6 +510,12 @@ public static List<Entity> unique(List<Entity> entities2) {

}

/**
* Init Method to load map and set Game size
*
* @param mapString
* Content of the Map file
*/
public void initFromString(String mapString) {
this.map = mapString;
Game.entities = new CopyOnWriteArrayList<Entity>();
Expand Down
Loading

0 comments on commit d2e8bd5

Please sign in to comment.