diff --git a/src/break_out/model/Ball.java b/src/break_out/model/Ball.java index 4758721..845d24e 100644 --- a/src/break_out/model/Ball.java +++ b/src/break_out/model/Ball.java @@ -6,6 +6,7 @@ import break_out.Constants; * This class contains the information about the balls characteristics and behavior * * @author iSchumacher + * @author modified by 175 * */ public class Ball implements IBall{ @@ -51,31 +52,30 @@ public class Ball implements IBall{ } /** - * + * updates ball position */ public void updatePosition() { - // @rxbn, Ruben Meyer + // sets X position this.position.setX(this.position.getX()+this.direction.getDx()); + + // sets Y position this.position.setY(this.position.getY()+this.direction.getDy()); } /** - * + * Ball reacts to contact with the borders */ public void reactOnBorder() { - - // @rxbn, Ruben Meyer - - // left border + // reacts on left border if(this.position.getX() < 0) this.direction.setDx(-(this.direction.getDx())); - // right border + // reacts on right border (+Diameter because of hitbox) if(this.position.getX()+Constants.BALL_DIAMETER > Constants.SCREEN_WIDTH) this.direction.setDx(-(this.direction.getDx())); - // top border + // reacts on top border if(this.position.getY() < 0) this.direction.setDy(-(this.direction.getDy())); - // bottom border + // reacts on bottom border (+Diameter because of hitbox) if(this.position.getY()+Constants.BALL_DIAMETER > Constants.SCREEN_HEIGHT) this.direction.setDy(-(this.direction.getDy())); } diff --git a/src/break_out/model/Level.java b/src/break_out/model/Level.java index a8653f5..3f7d3a2 100644 --- a/src/break_out/model/Level.java +++ b/src/break_out/model/Level.java @@ -6,6 +6,7 @@ package break_out.model; * * @author dmlux * @author I. Schumacher + * @author modified by 175 */ public class Level extends Thread { diff --git a/src/break_out/model/Vector2D.java b/src/break_out/model/Vector2D.java index 4dbaa9a..3900792 100644 --- a/src/break_out/model/Vector2D.java +++ b/src/break_out/model/Vector2D.java @@ -7,6 +7,7 @@ import break_out.model.Position; * This class represent a two dimensional vector. * * @author I. Schumacher + * @author modified by 175 */ public class Vector2D implements IVector2D { @@ -67,11 +68,11 @@ public class Vector2D implements IVector2D { this.dy = dy; } - /* + /** * Rescale part */ public void rescale() { - // calc unit vector + // calc unit vector and set it double vectorlength = Math.sqrt(Math.pow(getDx(), 2) + Math.pow(getDy(), 2)); setDx((1/vectorlength) * getDx() * Constants.BALL_SPEED); setDy((1/vectorlength) * getDy() * Constants.BALL_SPEED); diff --git a/src/break_out/view/Field.java b/src/break_out/view/Field.java index c5c63ba..8dc9104 100644 --- a/src/break_out/view/Field.java +++ b/src/break_out/view/Field.java @@ -15,7 +15,7 @@ import net.miginfocom.swing.MigLayout; * The field represents the board of the game. All components are on the board * * @author dmlux, modified by iSchumacher - * + * @author modified by 175 */ public class Field extends JPanel { diff --git a/src/break_out/view/View.java b/src/break_out/view/View.java index 8b1de7b..f517b4a 100644 --- a/src/break_out/view/View.java +++ b/src/break_out/view/View.java @@ -12,6 +12,7 @@ import break_out.model.Game; * gets the components from the game which is connected to this class * * @author dmlux + * @author modified by 175 * */ public class View extends JFrame { @@ -71,7 +72,7 @@ public class View extends JFrame { setVisible(true); pack(); - // hotfix: screen size + // hotfix: zero-sized window size on linux setMinimumSize(new Dimension(1, 1)); }