diff --git a/.fuse_hidden0000000600000001 b/.fuse_hidden0000000600000001 deleted file mode 100644 index 2d8f4c6..0000000 --- a/.fuse_hidden0000000600000001 +++ /dev/null @@ -1,510 +0,0 @@ -import javax.swing.*; -import java.awt.*; -import java.util.List; - -/* Clase que contiene el juego no serializable imagenes etc */ -/* Actua como un envoltorio para el BoardS que si se envia por red */ -/* Se ejecuta en la parte del cliente y engloba al BoardS (serializable)*/ -public class BoardN extends JPanel implements java.io.Serializable { - /* La parte serializable de Board */ - BoardS bS; - /* Used to call sound effects */ - GameSounds sounds; - - /* Banderas de estado*/ - boolean titleScreen; - boolean winScreen=false; - boolean overScreen=false; - /* Dying is used to count frames in the dying animation. If it's non-zero, - pacman is in the process of dying */ - int dying=0; - /* Lista con los amigos conectados*/ - List l; - /* Asignara el objeto Player desde la lista solo la primera vez */ - boolean primeraEjecucion=true; - /* Costructor */ - public BoardN(BoardS boardSerializable) { - titleScreen=true; - bS=boardSerializable; - sounds=new GameSounds(); - } - /* For JAR File*/ - Image pacmanImage=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/pacman.jpg")); - Image pacmanUpImage=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/pacmanup.jpg")); - Image pacmanDownImage=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/pacmandown.jpg")); - Image pacmanLeftImage=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/pacmanleft.jpg")); - Image pacmanRightImage=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/pacmanright.jpg")); - Image ghost10=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/ghost10.jpg")); - Image ghost20=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/ghost20.jpg")); - Image ghost30=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/ghost30.jpg")); - Image ghost40=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/ghost40.jpg")); - Image ghost11=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/ghost11.jpg")); - Image ghost21=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/ghost21.jpg")); - Image ghost31=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/ghost31.jpg")); - Image ghost41=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/ghost41.jpg")); - Image titleScreenImage=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/titleScreen.jpg")); - Image gameOverImage=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/gameOver.jpg")); - Image winScreenImage=Toolkit.getDefaultToolkit().getImage(Pacman.class.getResource("img/winScreen.jpg")); - /* For NOT JAR file*/ - // Image pacmanImage=(Image)Toolkit.getDefaultToolkit().getImage("img/pacman.jpg"); - // Image pacmanUpImage=(Image)Toolkit.getDefaultToolkit().getImage("img/pacmanup.jpg"); - // Image pacmanDownImage=(Image)Toolkit.getDefaultToolkit().getImage("img/pacmandown.jpg"); - // Image pacmanLeftImage=(Image)Toolkit.getDefaultToolkit().getImage("img/pacmanleft.jpg"); - // Image pacmanRightImage=(Image)Toolkit.getDefaultToolkit().getImage("img/pacmanright.jpg"); - // Image ghost10=(Image)Toolkit.getDefaultToolkit().getImage("img/ghost10.jpg"); - // Image ghost20=(Image)Toolkit.getDefaultToolkit().getImage("img/ghost20.jpg"); - // Image ghost30=(Image)Toolkit.getDefaultToolkit().getImage("img/ghost30.jpg"); - // Image ghost40=(Image)Toolkit.getDefaultToolkit().getImage("img/ghost40.jpg"); - // Image ghost11=(Image)Toolkit.getDefaultToolkit().getImage("img/ghost11.jpg"); - // Image ghost21=(Image)Toolkit.getDefaultToolkit().getImage("img/ghost21.jpg"); - // Image ghost31=(Image)Toolkit.getDefaultToolkit().getImage("img/ghost31.jpg"); - // Image ghost41=(Image)Toolkit.getDefaultToolkit().getImage("img/ghost41.jpg"); - // Image titleScreenImage=(Image)Toolkit.getDefaultToolkit().getImage("img/titleScreen.jpg"); - // Image gameOverImage=(Image)Toolkit.getDefaultToolkit().getImage("img/gameOver.jpg"); - // Image winScreenImage=(Image)Toolkit.getDefaultToolkit().getImage("img/winScreen.jpg"); - /* This is the main function that draws one entire frame of the game */ - public void paint(Graphics g) - { - /* If we're playing the dying animation, don't update the entire screen. - Just kill the pacman*/ - if (dying>0) - { - /* Stop any pacman eating sounds */ - sounds.nomNomStop(); - /* Draw the pacman */ - g.drawImage(pacmanImage, bS.player.x, bS.player.y, Color.BLACK, null); - // pacmanImage.paintIcon(this, g, player.x, player.y); - g.setColor(Color.BLACK); - /* Kill the pacman */ - if (dying==4) - g.fillRect(bS.player.x, bS.player.y, 20, 7); - else if (dying==3) - g.fillRect(bS.player.x, bS.player.y, 20, 14); - else if (dying==2) - g.fillRect(bS.player.x, bS.player.y, 20, 20); - else if (dying==1) - { - g.fillRect(bS.player.x, bS.player.y, 20, 20); - } - /* Take .1 seconds on each frame of death, and then take 2 seconds - for the final frame to allow for the sound effect to end */ - long currTime=System.currentTimeMillis(); - long temp; - if (dying!=1) - temp=100; - else - temp=2000; - /* If it's time to draw a new death frame... */ - if (currTime-bS.timer>=temp) - { - dying--; - bS.timer=currTime; - /* If this was the last death frame...*/ - if (dying==0) - { - if (bS.numLives==-1) - { - /* Demo mode has infinite lives, just give it more lives*/ - if (bS.demo) - bS.numLives=2; - else - { - /* Game over for player. If relevant, update high score. Set gameOver flag*/ - if (bS.player.currScore>bS.highScore) - { - bS.updateScore(bS.player.currScore); - } - overScreen=true; - } - } - } - } - return; - } - /* If this is the title screen, draw the title screen and return */ - if (titleScreen) - { - g.setColor(Color.BLACK); - g.fillRect(0, 0, 600, 600); - g.drawImage(titleScreenImage, 0, 0, Color.BLACK, null); - /* Stop any pacman eating sounds */ - sounds.nomNomStop(); - bS.New=1; - return; - } - /* If this is the win screen, draw the win screen and return */ - else if (winScreen) - { - g.setColor(Color.BLACK); - g.fillRect(0, 0, 600, 600); - g.drawImage(winScreenImage, 0, 0, Color.BLACK, null); - bS.New=1; - /* Stop any pacman eating sounds */ - sounds.nomNomStop(); - return; - } - /* If this is the game over screen, draw the game over screen and return */ - else if (overScreen) - { - g.setColor(Color.BLACK); - g.fillRect(0, 0, 600, 600); - g.drawImage(gameOverImage, 0, 0, Color.BLACK, null); - bS.New=1; - /* Stop any pacman eating sounds */ - sounds.nomNomStop(); - return; - } - /* If need to update the high scores, redraw the top menu bar */ - if (bS.clearHighScores) - { - g.setColor(Color.BLACK); - g.fillRect(0, 0, 600, 18); - g.setColor(Color.YELLOW); - g.setFont(bS.font); - bS.clearHighScores=false; - if (bS.demo) - g.drawString("DEMO MODE PRESS ANY KEY TO START A GAME\t High Score: "+bS.highScore, 20, 10); - else - g.drawString("Score: "+(bS.player.currScore)+"\t High Score: "+bS.highScore, 20, 10); - } - /* oops is set to true when pacman has lost a life */ - boolean oops=false; - /* Game initialization */ - if (bS.New==1) - { - bS.reset(); - // player=new Player(200, 300); - bS.ghost1=new Ghost(180, 180); - bS.ghost2=new Ghost(200, 180); - bS.ghost3=new Ghost(220, 180); - bS.ghost4=new Ghost(220, 180); - bS.player.currScore=0; - bS.drawBoard(g); - bS.drawPellets(g); - bS.drawLives(g); - /* Send the game map to player and all ghosts */ - bS.player.updateState(bS.state); - /* Don't let the player go in the ghost box*/ - bS.player.state[9][7]=false; - // /* Manda el mapa a los Amigos */ - //if(l!=null) { - // for (int i=0; i=5000) - { - bS.New=0; - } - else - return; - } - /* Drawing optimization */ - /* Optimiza a los Amigos */ - //if(l!=null) { - // for (int i=0; ibS.highScore) - { - bS.updateScore(bS.player.currScore); - } - winScreen=true; - } - else - { - titleScreen=true; - } - return; - } - } - /* If we moved to a location without pellets, stop the sounds */ - else if ( (bS.player.pelletX!=bS.lastPelletEatenX||bS.player.pelletY!=bS.lastPelletEatenY )||bS.player.stopped) - { - /* Stop any pacman eating sounds */ - sounds.nomNomStop(); - } - /* Replace pellets that have been run over by ghosts */ - if ( bS.pellets[bS.ghost1.lastPelletX][bS.ghost1.lastPelletY]) - bS.fillPellet(bS.ghost1.lastPelletX, bS.ghost1.lastPelletY, g); - if ( bS.pellets[bS.ghost2.lastPelletX][bS.ghost2.lastPelletY]) - bS.fillPellet(bS.ghost2.lastPelletX, bS.ghost2.lastPelletY, g); - if ( bS.pellets[bS.ghost3.lastPelletX][bS.ghost3.lastPelletY]) - bS.fillPellet(bS.ghost3.lastPelletX, bS.ghost3.lastPelletY, g); - if ( bS.pellets[bS.ghost4.lastPelletX][bS.ghost4.lastPelletY]) - bS.fillPellet(bS.ghost4.lastPelletX, bS.ghost4.lastPelletY, g); - /* Remplaza los pellets por donde pasan los amigos*/ - //if(l!=null) { - // for (int i=0; i=10) - bS.ghost1.frameCount=0; - else - bS.ghost1.frameCount++; - } - // Dibuja los Amigos Pacmans - for (int i=0; i=10) - bS.player.frameCount=0; - - switch(bS.player.currDirection) - { - case 'L': - g.drawImage(pacmanLeftImage, bS.player.x, bS.player.y, Color.BLACK, null); - break; - case 'R': - g.drawImage(pacmanRightImage, bS.player.x, bS.player.y, Color.BLACK, null); - break; - case 'U': - g.drawImage(pacmanUpImage, bS.player.x, bS.player.y, Color.BLACK, null); - break; - case 'D': - g.drawImage(pacmanDownImage, bS.player.x, bS.player.y, Color.BLACK, null); - break; - } - } - } - // Por defecto se pintan fantasmas - else { - if(a.frameCount<5) { - g.drawImage(ghost10, a.x, a.y, Color.BLACK, null); - } - else { - g.drawImage(ghost11, a.x, a.y, Color.BLACK, null); - } - } - } - - /* Draw the border around the game in case it was overwritten by ghost movement or something */ - g.setColor(Color.WHITE); - g.drawRect(19, 19, 382, 382); - /* Draw the border around the game in case it was overwritten by ghost movement or something */ - g.setColor(Color.WHITE); - g.drawRect(19, 19, 382, 382); - } - - /* Devuelve el player de la lista segun el su nombre*/ - public Player PlayerPropio(String nombre) throws Exception { - Player a=null; - for (int i=0; i a) { - boolean aumento=false; - // Si existe l, se comprueba si han aumentado los clientes - if(l!=null) {aumento=(a.size()!=l.size()); } - // Se asigna siempre la lueva lista para actualizar los datos - // De todos los amigos y sus posiciones - l=a; - // Si son distintos se imprime la lista de usuarios - if (aumento) { - imprimeListaAmigos(); - } - // Si es la primera ejecucion se asigna un Player fijo al BoardS - if(primeraEjecucion) { - primeraEjecucion=false; - try { - imprimeListaAmigos(); - // Tambien asignamos un Player fijo al juego - bS.setPlayer(PlayerPropio(bS.getNombre())); - } - catch (Exception e) { - System.err.println("Excepcion en Amigos: "); - e.printStackTrace(); - } - } - updateComecocoStatus(); - super.repaint(); - } - public void imprimeListaAmigos() { - for (int i=0; i - - $PROJECT_DIR$/out/artifacts/Comecoco_jar - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml deleted file mode 100644 index f2277e1..0000000 --- a/.idea/codeStyleSettings.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index c6d8fb7..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index cb6e839..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 04b4454..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,893 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Abstraction issuesJava - - - Android Lint - - - Bitwise operation issuesJava - - - Class structureJava - - - Code style issuesJava - - - Inheritance issuesJava - - - JUnit issuesJava - - - Java - - - Java language level issuesJava - - - Java language level migration aidsJava - - - Javadoc issuesJava - - - Naming conventionsJava - - - Numeric issuesJava - - - Performance issuesJava - - - Probable bugsJava - - - Properties Files - - - TestNGJava - - - Threading issuesJava - - - XPath - - - - - Android - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1461938853365 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Comecoco:jar - - - - - - - - No facets are configured - - - - - - - - - - - - - - - 1.7 - - - - - - - - Comecoco - - - - - - - - 1.8 - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BoardN.class b/BoardN.class deleted file mode 100644 index 498ba48..0000000 Binary files a/BoardN.class and /dev/null differ diff --git a/BoardN.java b/BoardN.java index c517470..b97d52a 100644 --- a/BoardN.java +++ b/BoardN.java @@ -9,8 +9,7 @@ public class BoardN extends JPanel implements java.io.Serializable { /* La parte serializable de Board */ BoardS bS; /* Used to call sound effects */ - GameSounds sounds; - + GameSounds sounds;> /* Banderas de estado*/ boolean titleScreen; boolean winScreen=false; @@ -490,7 +489,6 @@ public void setAmigos(List a) { } } updateComecocoStatus(); - super.repaint(); } public void imprimeListaAmigos() { System.out.println("= Conectados ="); diff --git a/BoardS.class b/BoardS.class deleted file mode 100644 index f787ec4..0000000 Binary files a/BoardS.class and /dev/null differ diff --git a/ClientePac.class b/ClientePac.class deleted file mode 100644 index ba85270..0000000 Binary files a/ClientePac.class and /dev/null differ diff --git a/GameSounds.class b/GameSounds.class deleted file mode 100644 index ab58356..0000000 Binary files a/GameSounds.class and /dev/null differ diff --git a/Ghost.class b/Ghost.class deleted file mode 100644 index ac95d77..0000000 Binary files a/Ghost.class and /dev/null differ diff --git a/ImageS.class b/ImageS.class deleted file mode 100644 index 4a08a4b..0000000 Binary files a/ImageS.class and /dev/null differ diff --git a/Mover.class b/Mover.class deleted file mode 100644 index 11c0284..0000000 Binary files a/Mover.class and /dev/null differ diff --git a/Pacman$1.class b/Pacman$1.class deleted file mode 100644 index 7961362..0000000 Binary files a/Pacman$1.class and /dev/null differ diff --git a/Pacman.class b/Pacman.class deleted file mode 100644 index 270c10c..0000000 Binary files a/Pacman.class and /dev/null differ diff --git a/Player.class b/Player.class deleted file mode 100644 index 9b09bb6..0000000 Binary files a/Player.class and /dev/null differ diff --git a/ServicioPac.class b/ServicioPac.class deleted file mode 100644 index dae0896..0000000 Binary files a/ServicioPac.class and /dev/null differ diff --git a/ServicioPacImpl.class b/ServicioPacImpl.class deleted file mode 100644 index 11ee30b..0000000 Binary files a/ServicioPacImpl.class and /dev/null differ diff --git a/ServicioPacImpl.java b/ServicioPacImpl.java index 1589140..28d380b 100644 --- a/ServicioPacImpl.java +++ b/ServicioPacImpl.java @@ -78,9 +78,9 @@ public boolean promocionaComecoco(Player jugador) throws Exception { max=p.getScore(); } } - // El player es el que mayor puntuacion tiene - if(jugador.getScore()>=max) { return true; } - else { return false; } + // El fantasma es el que más puntuacion tiene + if(jugador.getScore()>=max) { return false; } + else { return true; } } /* Actualiza la posicion del jugador remoto en la lista*/ public List listaAmigos() throws Exception { diff --git a/ServidorPac.class b/ServidorPac.class deleted file mode 100644 index 6568d76..0000000 Binary files a/ServidorPac.class and /dev/null differ