Mejor uso del Singleton
This commit is contained in:
@@ -119,7 +119,7 @@ public class Arkanoid {
|
||||
|
||||
for (int i = 0; i < Ladrillo.colores.length; i++) {
|
||||
for (int j = 0; j < numLadrillosPorLinea; j++) {
|
||||
actores.add(new Ladrillo(anchoLadrillos, 10, i, j, separacionBloques));
|
||||
actores.add(new Ladrillo(anchoLadrillos, 10, i, j, separacionBloques, altoVentana/12));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,11 +175,4 @@ public class Arkanoid {
|
||||
return canvas;
|
||||
}
|
||||
|
||||
public static int getAltoVentana() {
|
||||
return altoVentana;
|
||||
}
|
||||
|
||||
public static int getAnchoVentana() {
|
||||
return anchoVentana;
|
||||
}
|
||||
}
|
||||
@@ -27,13 +27,13 @@ public class Jugador extends Actor {
|
||||
@Override
|
||||
public void actua() {
|
||||
if (movIzq && this.x > 0) this.x -= velocidadX;
|
||||
if (movDer && this.x + this.ancho < Arkanoid.getAnchoVentana()) this.x += velocidadX;
|
||||
if (movDer && this.x + this.ancho < Arkanoid.getInstance().getCanvas().getWidth()) this.x += velocidadX;
|
||||
}
|
||||
|
||||
public void movimientoRaton(int x, int y) {
|
||||
x = (x - ancho / 2);
|
||||
|
||||
if (x > 0 && x < Arkanoid.getAnchoVentana() - this.ancho) this.x = x;
|
||||
if (x > 0 && x < Arkanoid.getInstance().getCanvas().getWidth() - this.ancho) this.x = x;
|
||||
}
|
||||
|
||||
public void movimientoTecladoDerecha(boolean derecha) {
|
||||
|
||||
@@ -10,13 +10,13 @@ public class Ladrillo extends Actor {
|
||||
|
||||
int fila;
|
||||
|
||||
public Ladrillo(int ancho, int alto, int fila, int columna, int separacion) {
|
||||
public Ladrillo(int ancho, int alto, int fila, int columna, int separacion, int separacionSuperior) {
|
||||
this.setAncho(ancho);
|
||||
this.setAlto(alto);
|
||||
this.fila = fila;
|
||||
|
||||
this.x = separacion + (columna * ancho) + (separacion * columna);
|
||||
this.y = separacion + (fila * alto) + (separacion * fila) + (Arkanoid.getAltoVentana()/12);
|
||||
this.y = separacion + (fila * alto) + (separacion * fila) + separacionSuperior;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user