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.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();

View File

@ -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");
}
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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 {

View File

@ -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);

View File

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