Skip to content

Commit

Permalink
Ultimos retoques al juego 👍
Browse files Browse the repository at this point in the history
Se le añadieron los ultimos retoques al juego
  • Loading branch information
AlexMethod committed Jun 1, 2017
1 parent 46613ae commit 30e8353
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 50 deletions.
Binary file modified Game/core/assets/Jugador
Binary file not shown.
File renamed without changes
3 changes: 0 additions & 3 deletions Game/core/src/com/tiny/game/F1.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,4 @@ public void move(){
this.setY(this.getY()+1);
}

public Texture getImage(){
return membrana;
}
}
3 changes: 0 additions & 3 deletions Game/core/src/com/tiny/game/F2.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,4 @@ public void dibuja(SpriteBatch batch){
public void dibuja2(SpriteBatch batch){batch.draw(membrana2,x,y);}
public void dibuja3(SpriteBatch batch){batch.draw(membrana3,x,y);}
public void move(){this.setY(this.getY()+1);}
public Texture getImage(){
return membrana;
}
}
3 changes: 0 additions & 3 deletions Game/core/src/com/tiny/game/F3.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,5 @@ public void dibuja(SpriteBatch batch){
public void move(){
this.setY(this.getY()+1);
}
public Texture getImage(){
return membrana;
}
}

3 changes: 0 additions & 3 deletions Game/core/src/com/tiny/game/F4.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,4 @@ public void dibuja(SpriteBatch batch){
public void move(){
this.setY(this.getY()+1);
}
public Texture getImage(){
return membrana;
}
}
3 changes: 0 additions & 3 deletions Game/core/src/com/tiny/game/F5.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,4 @@ public void dibuja(SpriteBatch batch){
public void move(){
this.setY(this.getY()+1);
}
public Texture getImage(){
return membrana;
}
}
3 changes: 0 additions & 3 deletions Game/core/src/com/tiny/game/F6.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,4 @@ public void dibuja(SpriteBatch batch){
public void move(){
this.setY(this.getY()+1);
}
public Texture getImage(){
return membrana;
}
}
43 changes: 23 additions & 20 deletions Game/core/src/com/tiny/game/Juego.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class Juego {
private int pAuxH;
private int pAuxT;
private ArrayList<Globulo> arrayGlobulo;
private ArrayList<Virus> arrayVirus;
private ArrayList<VH> arrayVH;
private ArrayList<VT> arrayVT;
private ArrayList<Pastilla> arrayPastilla;
Expand Down Expand Up @@ -69,9 +68,9 @@ public void create () {
//Se crean los arreglos
arrayGlobulo = new ArrayList<Globulo>();
arrayPastilla = new ArrayList<Pastilla>();
arrayVirus = new ArrayList<Virus>();
arrayVH = new ArrayList<VH>();
arrayVT = new ArrayList<VT>();
//jugador = new Jugador("Jugador1");
jugador = new Jugador("Jugador1");
//Se añaden los objetos fondo
//En sus posiciones correspondientes
Expand Down Expand Up @@ -190,7 +189,7 @@ public void render (SpriteBatch batch) {
}
batch.end();
//Para crear mas globulos
if(arrayGlobulo.size()==2){
if(arrayGlobulo.size()<=2){
int randomx = random.nextInt(350) +1;
int randomy = random.nextInt(80) +1;
arrayGlobulo.add( new Globulo(randomx,randomy));
Expand All @@ -211,12 +210,11 @@ public void render (SpriteBatch batch) {
arrayGlobulo.remove(j);
this.jugador.setScore(jugador.getScore()+10);
puntos=Integer.toString(this.jugador.getScore());
System.out.println("Puntuaje: "+ this.jugador.getScore());
}
batch.end();
}
//Para crear mas Pastillas
if(arrayPastilla.size()== 0){
if(arrayPastilla.size()<= 0){
int randomx = random.nextInt(350)+1;
int randomy = random.nextInt(80)+1;
arrayPastilla.add( new Invencibilidad(randomx,randomy));
Expand All @@ -236,7 +234,6 @@ public void render (SpriteBatch batch) {
arrayPastilla.remove(i);
this.jugador.setScore(this.jugador.getScore()+20);
this.puntos=Integer.toString(this.jugador.getScore());
System.out.println("Puntuaje: "+ this.jugador.getScore());
}
batch.end();
}
Expand Down Expand Up @@ -269,14 +266,13 @@ public void render (SpriteBatch batch) {
sound1.play();
arrayVH.remove(i);
this.jugador.setScore(this.jugador.getScore()-100);
if(this.jugador.getScore()<0){
if(this.jugador.getScore()<0){ //Condicion para morir cuando su puntuaje sea menor a 0
if(this.jugador.getScore()>this.leerJugador().getScore()){
this.guardarJugador();
}
isPlaying = false;
}
this.puntos=Integer.toString(this.jugador.getScore());
System.out.println("Puntuaje: "+ this.jugador.getScore());
}
batch.end();
}
Expand Down Expand Up @@ -312,7 +308,6 @@ public void render (SpriteBatch batch) {
this.guardarJugador();
}
isPlaying=false;
System.out.println("Puntuaje: "+ this.jugador.getScore());
}
batch.end();
}
Expand Down Expand Up @@ -353,9 +348,9 @@ public void guardarJugador(){
objeto.close();
System.out.println("SAVED SUCCESFULLY...");
}catch(FileNotFoundException e){
System.out.println("ERROR..."+ e.getMessage());
System.out.println("FileNotFoundException..."+ e.getMessage());
}catch(IOException e){
System.out.println("ERROR..."+e.getMessage());
System.out.println("IOException..."+e.getMessage());
}
}
public Jugador leerJugador(){
Expand All @@ -366,11 +361,11 @@ public Jugador leerJugador(){
player = (Jugador)objeto.readObject();
//System.out.println("READ SUCCESFULLY...");
}catch(FileNotFoundException e){
System.out.println("ERROR..."+e.getMessage());
System.out.println("FileNotFoundException..."+e.getMessage());
}catch(IOException e){
System.out.println("ERROR..."+e.getMessage());
System.out.println("IOException..."+e.getMessage());
}catch (ClassNotFoundException e){
System.out.println("ERROR..."+e.getMessage());
System.out.println("ClassNotFoundException..."+e.getMessage());
}
return player;
}
Expand All @@ -381,14 +376,22 @@ public boolean isPlaying(){

public void resetGame(){
this.jugador.setScore(0);
puntos = "0";
this.isPlaying=true;
for(int i = 0;i<arrayVirus.size();i++){
arrayVirus.remove(i);
pAuxH=0;
pAuxT=0;
for(int i = 0;i<arrayVH.size();i++){
arrayVH.remove(i);
}
for(int i = 0;i<arrayVT.size();i++){
arrayVT.remove(i);
}
for(int i =0;i<arrayPastilla.size();i++){
arrayPastilla.remove(i);
}
for(int i = 0;i<arrayGlobulo.size();i++){
arrayGlobulo.remove(i);
}
arrayVirus.add(new VH(200,30));
arrayVirus.add(new VT(150,70));
arrayVirus.add(new VT(300,10));

}

public Jugador getJugador(){
Expand Down
5 changes: 2 additions & 3 deletions Game/core/src/com/tiny/game/Jugador.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import java.io.Serializable;

public class Jugador implements Serializable {
private String nom;
private int score;

private String nom;
public Jugador(String nom){
this.nom=nom;
this.score = 0;
this.nom =nom;
}
public void setScore(int score){
this.score=score;
Expand Down
4 changes: 0 additions & 4 deletions Game/core/src/com/tiny/game/VH.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ public void setX(int x){
@Override
public void setY(int y){
this.y=y;
}
@Override
public void ataque(){

}
@Override
public void move(){
Expand Down
4 changes: 1 addition & 3 deletions Game/core/src/com/tiny/game/VT.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void dibuja(SpriteBatch batch){
frameActual = (TextureRegion)animacion.getKeyFrame(tiempo,true);
batch.draw(frameActual,x,y);
}
@Override
public int getX(){
return x;
}
Expand All @@ -48,9 +49,6 @@ public void setY(int y){
this.y=y;
}

public void ataque(){

}
public void move(){
this.setY(this.getY()+1);
}
Expand Down
1 change: 0 additions & 1 deletion Game/core/src/com/tiny/game/Virus.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ public abstract class Virus extends Personaje {
public abstract void move();
@Override
public abstract void dibuja(SpriteBatch batch);
public abstract void ataque();
}
2 changes: 1 addition & 1 deletion Game/core/src/com/tiny/game/tiny.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void render () {
isCredits = false;
isHelp = false;
}
if(Gdx.input.isKeyPressed(Input.Keys.E)){
if(Gdx.input.isKeyPressed(Input.Keys.ESCAPE)){
player = juego.leerJugador();
if(this.juego.getJugador().getScore()>player.getScore()){
this.juego.guardarJugador();
Expand Down

0 comments on commit 30e8353

Please sign in to comment.