Terminados ajustes, errores menores arreglados

This commit is contained in:
Guillermo Roche 2020-02-20 23:22:03 +01:00
parent 9884106a7d
commit 207ccfc87f
13 changed files with 120 additions and 37 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 KiB

View File

@ -2,6 +2,7 @@ package com.mygdx.game;
import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
@ -25,15 +26,18 @@ public class MyGdxGame extends ApplicationAdapter {
int menuSeleccionado=0; int menuSeleccionado=0;
int aux=menuSeleccionado; int aux=menuSeleccionado;
boolean fin=false; boolean fin=false;
Color color;
@Override @Override
public void create () { public void create () {
this.color=new Color();
color.set(0.5f, 0, 0, 1);
batch = new SpriteBatch(); batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("CentieSans.fnt")); font = new BitmapFont(Gdx.files.internal("CentieSans.fnt"));
WIN_ALT=900; WIN_ALT=900;
WIN_ANCH=700; WIN_ANCH=700;
Gdx.graphics.setWindowedMode(WIN_ALT, WIN_ANCH); Gdx.graphics.setWindowedMode(WIN_ALT, WIN_ANCH);
Menu.menus.add(new MenuInicio()); 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 MenuSeleccion());
Menu.menus.add(new MenuSeleccion2p()); Menu.menus.add(new MenuSeleccion2p());
Menu.menus.add(new Fin()); Menu.menus.add(new Fin());
@ -41,7 +45,7 @@ public class MyGdxGame extends ApplicationAdapter {
@Override @Override
public void render () { 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); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin(); batch.begin();
float delta = Gdx.graphics.getDeltaTime(); float delta = Gdx.graphics.getDeltaTime();

View File

@ -23,7 +23,14 @@ public class Battle extends Menu{
this.p1=new Personaje(np1, false); this.p1=new Personaje(np1, false);
this.p1.setEnemigo(p2.getCaja()); this.p1.setEnemigo(p2.getCaja());
this.p2.setEnemigo(p1.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 @Override
@ -92,7 +99,7 @@ public class Battle extends Menu{
this.p1.setEnemigo(p2.getCaja()); this.p1.setEnemigo(p2.getCaja());
this.p2.setEnemigo(p1.getCaja()); this.p2.setEnemigo(p1.getCaja());
finalRound=true; finalRound=true;
suelo = new Texture("suelos/sueloBuda.png");
} }
} }

View File

@ -1,15 +1,28 @@
package menus; package menus;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class MenuOpcions extends Menu{ public class MenuOpcions extends Menu{
String[] fondos= {"muralla china", "ciudad china", "italia"};
public MenuOpcions() { String[] colores= {"rojo","azul","amarillo"};
int opcion1;
int opcion2;
String fondo;
boolean pres2;
Color color;
public MenuOpcions(Color color) {
super(); super();
this.color=color;
this.pres2=false;
this.opcion1=0;
this.opcion2=0;
this.n_opciones=2; this.n_opciones=2;
this.pres=true; this.pres=true;
this.local=Menu.OPCIONES; this.local=Menu.OPCIONES;
} }
@Override @Override
@ -18,25 +31,85 @@ public class MenuOpcions extends Menu{
switch(this.position) { switch(this.position) {
case 0:{ case 0:{
Menu.selector.draw(batch, Gdx.graphics.getWidth()/5, Gdx.graphics.getHeight()/2.2f); 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; break;
} }
case 1:{ case 1:{
Menu.selector.draw(batch, Gdx.graphics.getWidth()/5, 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+400, Gdx.graphics.getHeight()/4.2f); 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, "color fondo", Gdx.graphics.getWidth()/3.75f,Gdx.graphics.getHeight()/2);
font.draw(batch, "fondo:", Gdx.graphics.getWidth()/5,Gdx.graphics.getHeight()/4); 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(); return this.cambiarSeleccionado();
} }
int darSeleccionado() { int getFondo() {
switch(this.position) { return this.opcion2;
case 0:return 3; }
case 1:return Menu.OPCIONES;
default: return -1; 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;
}
} }

View File

@ -26,11 +26,12 @@ public class Ataque {
return valor*1.2f; return valor*1.2f;
}else if(tipo==Personaje.BAJO) { }else if(tipo==Personaje.BAJO) {
return valor*0.8f; return valor*0.8f;
}else {
return valor;
} }
break;
case Personaje.BAJO:{ case Personaje.BAJO:{
if(tipo==Personaje.BAJO) { if(tipo==Personaje.BAJO) {
return valor*1; return valor;
}else { }else {
return valor*0.5f; return valor*0.5f;

View File

@ -10,22 +10,23 @@ public class Bot extends Personaje{
int mover = (int)Math.round(Math.random()*3); int mover = (int)Math.round(Math.random()*3);
if (mover == 1) { if (mover == 1) {
if(this.position) { if(this.position) {
this.y++; if(y<450)this.y++;
}else { }else {
if(!this.caja.overlaps(enemigo)) { if((!this.caja.overlaps(enemigo))&&y<600) {
this.y++; this.y++;
} }
} }
} }
if (mover == 2) { if (mover == 2) {
if(!this.position) { if((!this.position)) {
this.y--; if(y>0)this.y--;
}else { }else {
if(!this.caja.overlaps(enemigo)) { if((!this.caja.overlaps(enemigo))) {
this.y--; this.y--;
} }
} }
} }
System.out.println(y);
if(position) { if(position) {
this.caja.setPosition(x, y+120); this.caja.setPosition(x, y+120);
}else { }else {

View File

@ -172,18 +172,18 @@ public class Personaje {
if (Gdx.input.isKeyPressed(this.keyR)) { if (Gdx.input.isKeyPressed(this.keyR)) {
if(this.position) { if(this.position) {
this.y++; if(y<450)this.y++;
}else { }else {
if(!this.caja.overlaps(enemigo)) { if((!this.caja.overlaps(enemigo))&&y<600) {
this.y++; this.y++;
} }
} }
} }
if (Gdx.input.isKeyPressed(this.keyL)) { if (Gdx.input.isKeyPressed(this.keyL)) {
if(!this.position) { if((!this.position)) {
this.y--; if(y>0)this.y--;
}else { }else {
if(!this.caja.overlaps(enemigo)) { if((!this.caja.overlaps(enemigo))) {
this.y--; this.y--;
} }
} }
@ -233,9 +233,6 @@ public class Personaje {
} }
private void ryu(boolean position) { 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.standby=new Gifs("ryu/stand", 6, position);
this.medio=new Gifs("ryu/frente", 3, position); this.medio=new Gifs("ryu/frente", 3, position);
this.alto=new Gifs("ryu/arriba", 3, position); this.alto=new Gifs("ryu/arriba", 3, position);
@ -243,9 +240,6 @@ public class Personaje {
} }
private void ken(boolean position) { 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.standby=new Gifs("ken/stand", 6, position);
this.medio=new Gifs("ken/frente", 3, position); this.medio=new Gifs("ken/frente", 3, position);
this.alto=new Gifs("ken/arriba", 3, position); this.alto=new Gifs("ken/arriba", 3, position);
@ -253,9 +247,6 @@ public class Personaje {
} }
private void cam(boolean position) { 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.standby=new Gifs("cam/stand", 8, position);
this.medio=new Gifs("cam/fente", 6, position); this.medio=new Gifs("cam/fente", 6, position);
this.alto=new Gifs("cam/arriba", 4, position); this.alto=new Gifs("cam/arriba", 4, position);

View File

@ -6,3 +6,9 @@
/ryu/ /ryu/
/cam/ /cam/
/ken/ /ken/
/sueloBuda.png
/suelos/
/125760.png
/CentieSans.fnt
/CentieSans.ttf_0.png
/badlogic.jpg