diff --git a/core/assets/suelos/sueloBuda.png b/core/assets/suelos/sueloBuda.png new file mode 100644 index 0000000..0dd6f72 Binary files /dev/null and b/core/assets/suelos/sueloBuda.png differ diff --git a/core/assets/suelos/sueloChina.png b/core/assets/suelos/sueloChina.png new file mode 100644 index 0000000..a865b32 Binary files /dev/null and b/core/assets/suelos/sueloChina.png differ diff --git a/core/assets/suelos/sueloChinaCiudad.png b/core/assets/suelos/sueloChinaCiudad.png new file mode 100644 index 0000000..e9b82a4 Binary files /dev/null and b/core/assets/suelos/sueloChinaCiudad.png differ diff --git a/core/assets/suelos/sueloItalia.png b/core/assets/suelos/sueloItalia.png new file mode 100644 index 0000000..1ce8150 Binary files /dev/null and b/core/assets/suelos/sueloItalia.png differ diff --git a/core/bin/main/com/mygdx/game/MyGdxGame.class b/core/bin/main/com/mygdx/game/MyGdxGame.class index 21e1c12..df32f91 100644 Binary files a/core/bin/main/com/mygdx/game/MyGdxGame.class and b/core/bin/main/com/mygdx/game/MyGdxGame.class differ diff --git a/core/bin/main/menus/MenuOpcions.class b/core/bin/main/menus/MenuOpcions.class index cde282f..0d23d77 100644 Binary files a/core/bin/main/menus/MenuOpcions.class and b/core/bin/main/menus/MenuOpcions.class differ diff --git a/core/src/com/mygdx/game/MyGdxGame.java b/core/src/com/mygdx/game/MyGdxGame.java index 5e24aba..a8f115d 100644 --- a/core/src/com/mygdx/game/MyGdxGame.java +++ b/core/src/com/mygdx/game/MyGdxGame.java @@ -2,6 +2,7 @@ package com.mygdx.game; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; @@ -25,15 +26,18 @@ public class MyGdxGame extends ApplicationAdapter { int menuSeleccionado=0; int aux=menuSeleccionado; boolean fin=false; + Color color; @Override public void create () { + this.color=new Color(); + color.set(0.5f, 0, 0, 1); batch = new SpriteBatch(); font = new BitmapFont(Gdx.files.internal("CentieSans.fnt")); WIN_ALT=900; WIN_ANCH=700; Gdx.graphics.setWindowedMode(WIN_ALT, WIN_ANCH); Menu.menus.add(new MenuInicio()); - Menu.menus.add(new MenuOpcions()); + Menu.menus.add(new MenuOpcions(color)); Menu.menus.add(new MenuSeleccion()); Menu.menus.add(new MenuSeleccion2p()); Menu.menus.add(new Fin()); @@ -41,7 +45,7 @@ public class MyGdxGame extends ApplicationAdapter { @Override public void render () { - Gdx.gl.glClearColor(0.5f, 0, 0, 1); + Gdx.gl.glClearColor(color.r, color.g, color.b, color.a); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); float delta = Gdx.graphics.getDeltaTime(); diff --git a/core/src/menus/Battle.java b/core/src/menus/Battle.java index 6edd124..f20f9c9 100644 --- a/core/src/menus/Battle.java +++ b/core/src/menus/Battle.java @@ -23,7 +23,14 @@ public class Battle extends Menu{ this.p1=new Personaje(np1, false); this.p1.setEnemigo(p2.getCaja()); this.p2.setEnemigo(p1.getCaja()); - suelo = new Texture("sueloChina.png"); + switch(((MenuOpcions)Menu.menus.get(Menu.OPCIONES)).getFondo()) { + case 0: suelo = new Texture("suelos/sueloChina.png"); + break; + case 1: suelo = new Texture("suelos/sueloChinaCiudad.png"); + break; + case 2: suelo = new Texture("suelos/sueloItalia.png"); + break; + } } @Override @@ -92,7 +99,7 @@ public class Battle extends Menu{ this.p1.setEnemigo(p2.getCaja()); this.p2.setEnemigo(p1.getCaja()); finalRound=true; - + suelo = new Texture("suelos/sueloBuda.png"); } } diff --git a/core/src/menus/MenuOpcions.java b/core/src/menus/MenuOpcions.java index 2ae53e9..477e765 100644 --- a/core/src/menus/MenuOpcions.java +++ b/core/src/menus/MenuOpcions.java @@ -1,15 +1,28 @@ package menus; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input; +import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class MenuOpcions extends Menu{ - - public MenuOpcions() { + String[] fondos= {"muralla china", "ciudad china", "italia"}; + String[] colores= {"rojo","azul","amarillo"}; + int opcion1; + int opcion2; + String fondo; + boolean pres2; + Color color; + public MenuOpcions(Color color) { super(); + this.color=color; + this.pres2=false; + this.opcion1=0; + this.opcion2=0; this.n_opciones=2; this.pres=true; this.local=Menu.OPCIONES; + } @Override @@ -18,25 +31,85 @@ public class MenuOpcions extends Menu{ switch(this.position) { case 0:{ Menu.selector.draw(batch, Gdx.graphics.getWidth()/5, Gdx.graphics.getHeight()/2.2f); - Menu.selector.draw(batch, Gdx.graphics.getWidth()/5+200, Gdx.graphics.getHeight()/2.2f); + Menu.selector.draw(batch, Gdx.graphics.getWidth()/5+280, Gdx.graphics.getHeight()/2.2f); break; } case 1:{ - Menu.selector.draw(batch, Gdx.graphics.getWidth()/5, Gdx.graphics.getHeight()/4.2f); - Menu.selector.draw(batch, Gdx.graphics.getWidth()/5+400, Gdx.graphics.getHeight()/4.2f); + Menu.selector.draw(batch, Gdx.graphics.getWidth()/5, Gdx.graphics.getHeight()/3.9f); + Menu.selector.draw(batch, Gdx.graphics.getWidth()/5+230, Gdx.graphics.getHeight()/3.9f); } } - font.draw(batch, "resolucion", Gdx.graphics.getWidth()/3.75f,Gdx.graphics.getHeight()/2); - font.draw(batch, "fondo:", Gdx.graphics.getWidth()/5,Gdx.graphics.getHeight()/4); + font.draw(batch, "color fondo", Gdx.graphics.getWidth()/3.75f,Gdx.graphics.getHeight()/2); + font.draw(batch, this.colores[this.opcion1], Gdx.graphics.getWidth()/3.2f,Gdx.graphics.getHeight()/2.3f); + font.draw(batch, "escenario", Gdx.graphics.getWidth()/3.75f,Gdx.graphics.getHeight()/3.2f); + font.draw(batch, this.fondos[this.opcion2], Gdx.graphics.getWidth()/4f,Gdx.graphics.getHeight()/5f); + this.seleccionOpcion(); return this.cambiarSeleccionado(); } - int darSeleccionado() { - switch(this.position) { - case 0:return 3; - case 1:return Menu.OPCIONES; - default: return -1; + int getFondo() { + return this.opcion2; + } + + void seleccionOpcion(){ + if(this.position==0) { + if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)) { + if(!this.pres2) { + this.opcion1++; + if(this.opcion1>=this.colores.length) { + this.opcion1=0; + } + this.cambiarColor(); + this.pres2=true; + } + }else if(Gdx.input.isKeyPressed(Input.Keys.LEFT)) { + if(!this.pres2) { + this.opcion1--; + if(this.opcion1<0) { + this.opcion1=this.colores.length; + } + this.cambiarColor(); + this.pres2=true; + } + }else if(this.pres2) { + this.pres2=false; + } + }else if(this.position==1) { + if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)) { + if(!this.pres2) { + this.opcion2++; + if(this.opcion2>=this.fondos.length) { + this.opcion2=0; + } + this.pres2=true; + } + }else if(Gdx.input.isKeyPressed(Input.Keys.LEFT)) { + if(!this.pres2) { + this.opcion2--; + if(this.opcion2<0) { + this.opcion2=this.fondos.length; + } + this.pres2=true; + } + }else if(this.pres2) { + this.pres2=false; + } } } + + void cambiarColor() { + switch(this.opcion1) { + case 0:this.color.set(0.5f, 0, 0, 1); + break; + case 1:this.color.set(0, 0, 0.5f, 1); + break; + case 2: this.color.set(0.5f, 0.5f, 0, 1); + break; + } + } + + int darSeleccionado() { + return Menu.INICIAL; + } } diff --git a/core/src/utilidades/Ataque.java b/core/src/utilidades/Ataque.java index b8a292d..b067aa0 100644 --- a/core/src/utilidades/Ataque.java +++ b/core/src/utilidades/Ataque.java @@ -26,11 +26,12 @@ public class Ataque { return valor*1.2f; }else if(tipo==Personaje.BAJO) { return valor*0.8f; + }else { + return valor; } - break; case Personaje.BAJO:{ if(tipo==Personaje.BAJO) { - return valor*1; + return valor; }else { return valor*0.5f; diff --git a/core/src/utilidades/Bot.java b/core/src/utilidades/Bot.java index 4accacb..606e241 100644 --- a/core/src/utilidades/Bot.java +++ b/core/src/utilidades/Bot.java @@ -10,22 +10,23 @@ public class Bot extends Personaje{ int mover = (int)Math.round(Math.random()*3); if (mover == 1) { if(this.position) { - this.y++; + if(y<450)this.y++; }else { - if(!this.caja.overlaps(enemigo)) { + if((!this.caja.overlaps(enemigo))&&y<600) { this.y++; } } } if (mover == 2) { - if(!this.position) { - this.y--; + if((!this.position)) { + if(y>0)this.y--; }else { - if(!this.caja.overlaps(enemigo)) { + if((!this.caja.overlaps(enemigo))) { this.y--; } } } + System.out.println(y); if(position) { this.caja.setPosition(x, y+120); }else { diff --git a/core/src/utilidades/Personaje.java b/core/src/utilidades/Personaje.java index 9109bb7..1a140ed 100644 --- a/core/src/utilidades/Personaje.java +++ b/core/src/utilidades/Personaje.java @@ -172,18 +172,18 @@ public class Personaje { if (Gdx.input.isKeyPressed(this.keyR)) { if(this.position) { - this.y++; + if(y<450)this.y++; }else { - if(!this.caja.overlaps(enemigo)) { + if((!this.caja.overlaps(enemigo))&&y<600) { this.y++; } } } if (Gdx.input.isKeyPressed(this.keyL)) { - if(!this.position) { - this.y--; + if((!this.position)) { + if(y>0)this.y--; }else { - if(!this.caja.overlaps(enemigo)) { + if((!this.caja.overlaps(enemigo))) { this.y--; } } @@ -233,9 +233,6 @@ public class Personaje { } private void ryu(boolean position) { - /*this.standby=new Gifs("p1.png", 5, 0, 74, 120, 70, 100, position); - this.medio=new Gifs("p1.png", 3, 4, 93, 355, 88, 100, position); - this.alto=new Gifs("p1.png", 3, 8, 74, 779, 75, 130, position);*/ this.standby=new Gifs("ryu/stand", 6, position); this.medio=new Gifs("ryu/frente", 3, position); this.alto=new Gifs("ryu/arriba", 3, position); @@ -243,9 +240,6 @@ public class Personaje { } private void ken(boolean position) { - /*this.standby=new Gifs("p2.png", 5, 0, 70, 863, 67, 93, position); - this.medio=new Gifs("p2.png", 2, 0, 70, 1145, 72, 100, position); - this.alto=new Gifs("p2.png", 3, 6, 74, 2920, 75, 130, position);*/ this.standby=new Gifs("ken/stand", 6, position); this.medio=new Gifs("ken/frente", 3, position); this.alto=new Gifs("ken/arriba", 3, position); @@ -253,9 +247,6 @@ public class Personaje { } private void cam(boolean position) { - /*this.standby=new Gifs("p3.png", 8, 0, 78, 113, 75, 98, position); - this.medio=new Gifs("p3.png", 2, 77, 86, 613, 90, 100, position); - this.alto=new Gifs("p3.png", 2, 192, 68, 1327, 60, 100, position);*/ this.standby=new Gifs("cam/stand", 8, position); this.medio=new Gifs("cam/fente", 6, position); this.alto=new Gifs("cam/arriba", 4, position); diff --git a/desktop/bin/main/.gitignore b/desktop/bin/main/.gitignore index 77a2ba2..26acb37 100644 --- a/desktop/bin/main/.gitignore +++ b/desktop/bin/main/.gitignore @@ -6,3 +6,9 @@ /ryu/ /cam/ /ken/ +/sueloBuda.png +/suelos/ +/125760.png +/CentieSans.fnt +/CentieSans.ttf_0.png +/badlogic.jpg