diff --git a/.idea/dictionaries/h4ckx0r.xml b/.idea/dictionaries/h4ckx0r.xml new file mode 100644 index 0000000..3efaf42 --- /dev/null +++ b/.idea/dictionaries/h4ckx0r.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 554d1e1..bd44701 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/src/otros/arkanoid/Juego.java b/src/otros/arkanoid/Juego.java new file mode 100644 index 0000000..5186a58 --- /dev/null +++ b/src/otros/arkanoid/Juego.java @@ -0,0 +1,21 @@ +package otros.arkanoid; + +import capitulo04.utils.Utils; + +public class Juego { + public static void main(String[] args) { + Ladrillo[] ladrillos = new Ladrillo[20]; + Pelota pelota = new Pelota(); + + for (int i = 0; i < ladrillos.length; i++) { + ladrillos[i] = new Ladrillo(); + } + + while (true) { + pelota.setX(Utils.generarIntAleatorioEntreLimites(0,800)); + pelota.setY(Utils.generarIntAleatorioEntreLimites(0,800)); + + + } + } +} diff --git a/src/otros/arkanoid/Ladrillo.java b/src/otros/arkanoid/Ladrillo.java new file mode 100644 index 0000000..6dbb675 --- /dev/null +++ b/src/otros/arkanoid/Ladrillo.java @@ -0,0 +1,103 @@ +package otros.arkanoid; + +import capitulo04.utils.Utils; + +public class Ladrillo { + private String color; + private int x; + private int y; + private int ancho; + private int alto; + private int puntosVida; + + public Ladrillo() { + this.x = Utils.generarIntAleatorioEntreLimites(0, 800); + this.y = Utils.generarIntAleatorioEntreLimites(0, 500); + this.ancho = 100; + this.alto = 50; + this.puntosVida = Utils.generarIntAleatorioEntreLimites(1, 3); + + String[] colores = new String[]{"rojo", "verde", "azul"}; + if (puntosVida == 1) { + int colorEscogido = Utils.generarIntAleatorioEntreLimites(0, 2); + this.color = colores[colorEscogido]; + } else if (puntosVida == 2) { + this.color = "plateado"; + } else { + this.color = "dorado"; + } + } + + /** + * @param p Pelota + * @return Devuelve si tiene vida o se ha quedado a 0 + */ + public boolean pelotaChocaEnLadrillo(Pelota p) { + if (p.getX() > this.x + && p.getY() > this.y) { + + } + return false; + } + + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public int getX() { + return x; + } + + public void setX(int x) { + this.x = x; + } + + public int getY() { + return y; + } + + public void setY(int y) { + this.y = y; + } + + public int getAncho() { + return ancho; + } + + public void setAncho(int ancho) { + this.ancho = ancho; + } + + public int getAlto() { + return alto; + } + + public void setAlto(int alto) { + this.alto = alto; + } + + public int getPuntosVida() { + return puntosVida; + } + + public void setPuntosVida(int puntosVida) { + this.puntosVida = puntosVida; + } + + @Override + public String toString() { + return "Ladrillo{" + + "color='" + color + '\'' + + ", x=" + x + + ", y=" + y + + ", ancho=" + ancho + + ", alto=" + alto + + ", puntosVida=" + puntosVida + + '}'; + } +} diff --git a/src/otros/arkanoid/Pelota.java b/src/otros/arkanoid/Pelota.java new file mode 100644 index 0000000..c87bc4a --- /dev/null +++ b/src/otros/arkanoid/Pelota.java @@ -0,0 +1,33 @@ +package otros.arkanoid; + +public class Pelota { + private int x; + private int y; + + public Pelota() { + } + + public int getX() { + return x; + } + + public void setX(int x) { + this.x = x; + } + + public int getY() { + return y; + } + + public void setY(int y) { + this.y = y; + } + + @Override + public String toString() { + return "Pelota{" + + "x=" + x + + ", y=" + y + + '}'; + } +} diff --git a/src/otros/cromos/Cromo.java b/src/otros/cromos/Cromo.java new file mode 100644 index 0000000..838e478 --- /dev/null +++ b/src/otros/cromos/Cromo.java @@ -0,0 +1,49 @@ +package otros.cromos; + +public class Cromo { + private String nombreJugador; + private int puntuacion; + private String equipo; + + public Cromo() { + } + + public Cromo(String nombreJugador, int puntuacion, String equipo) { + this.nombreJugador = nombreJugador; + this.puntuacion = puntuacion; + this.equipo = equipo; + } + + public String getNombreJugador() { + return nombreJugador; + } + + public void setNombreJugador(String nombreJugador) { + this.nombreJugador = nombreJugador; + } + + private int getPuntuacion() { + return puntuacion; + } + + public void setPuntuacion(int puntuacion) { + this.puntuacion = puntuacion; + } + + public String getEquipo() { + return equipo; + } + + public void setEquipo(String equipo) { + this.equipo = equipo; + } + + @Override + public String toString() { + return "Cromo{" + + "nombre='" + nombreJugador + '\'' + + ", puntuacion=" + puntuacion + + ", equipo='" + equipo + '\'' + + '}'; + } +} diff --git a/src/otros/cromos/CromoBaloncesto.java b/src/otros/cromos/CromoBaloncesto.java new file mode 100644 index 0000000..08e8173 --- /dev/null +++ b/src/otros/cromos/CromoBaloncesto.java @@ -0,0 +1,31 @@ +package otros.cromos; + +public class CromoBaloncesto extends Cromo{ + private int altura; + + public CromoBaloncesto() { + } + + public CromoBaloncesto(String nombreJugador, int puntuacion, String equipo) { + super(nombreJugador, puntuacion, equipo); + } + + public CromoBaloncesto(String nombreJugador, int puntuacion, String equipo, int altura) { + super(nombreJugador, puntuacion, equipo); + this.altura = altura; + } + + public int getAltura() { + return altura; + } + + public void setAltura(int altura) { + this.altura = altura; + } + + public void prueba() { + + } + + +} diff --git a/src/otros/cromos/CromoFutbol.java b/src/otros/cromos/CromoFutbol.java new file mode 100644 index 0000000..5c9138c --- /dev/null +++ b/src/otros/cromos/CromoFutbol.java @@ -0,0 +1,10 @@ +package otros.cromos; + +public class CromoFutbol extends Cromo{ + public CromoFutbol() { + } + + public CromoFutbol(String nombreJugador, int puntuacion, String equipo) { + super(nombreJugador, puntuacion, equipo); + } +} diff --git a/src/otros/cromos/Principal.java b/src/otros/cromos/Principal.java new file mode 100644 index 0000000..972076b --- /dev/null +++ b/src/otros/cromos/Principal.java @@ -0,0 +1,9 @@ +package otros.cromos; + +public class Principal { + public static void main(String[] args) { + CromoBaloncesto pepe = new CromoBaloncesto("Hola", 70, "pepe"); + //System.out.println(pepe/*.getPuntuacion()*/); + + } +}