Alien.java

   1 /**
   2  * @author CARMEN ULDY SOTO SAENZ
   3  * @author CLAUDIA LILIANA MATEUS NOVA
   4  */
   5 
   6 import java.awt.Frame;
   7 
   8 public class Interfaz {
   9         public static void main(String[] args) {
  10                 Frame marco= new Frame("MazeDallcu");
  11                 Lienzo l= new Lienzo();
  12 
  13                 //Fondo
  14                 Fondo fondo=new Fondo (0,0, 1020, 710);
  15                 l.add(fondo);
  16                 fondo.setVisible(true);
  17                 
  18                 //Paredes
  19         Pared[] paredes = {
  20                         new Pared(12, 10, 992, 10),
  21                                 new Pared(10, 10, 10, 320),
  22                                 new Pared(10, 690, 990, 10),       
  23                                 new Pared(1000, 10, 10, 684),       
  24                                 new Pared(10, 490, 10, 200),        
  25                                 new Pared(100,190, 10, 390),
  26                                 new Pared(12, 490, 90, 10),
  27                                 new Pared(190, 10, 10, 200),
  28                                 new Pared(120, 100, 70, 10),
  29                                 new Pared(103, 570, 90, 10),
  30                                 new Pared(103,400, 90, 10),
  31                                 new Pared(103, 300, 250, 10),
  32                                 new Pared(280, 150, 10, 150),
  33                                 new Pared(280, 490, 10, 200),
  34                                 new Pared(200, 490, 80, 10),
  35                                 new Pared(380, 10, 10, 200),
  36                                 new Pared(380, 100, 200, 10),
  37                                 new Pared(380, 210, 150, 10),
  38                                 new Pared(530, 210, 10, 50),
  39                                 new Pared(300, 380, 337, 10),
  40                                 new Pared(350, 300, 10, 80),
  41                                 new Pared(370, 380, 10, 80),
  42                                 new Pared(455, 300, 10, 160),
  43                                 new Pared(455, 460, 90, 10),
  44                                 new Pared(542, 460, 10, 80),
  45                                 new Pared(420, 540, 250, 10),
  46                                 new Pared(520, 615, 150, 10),
  47                                 new Pared(520, 540, 10, 78),
  48                                 new Pared(380, 616, 10, 78),
  49                                 new Pared(627, 260, 10, 120),
  50                                 new Pared(627, 260, 90, 10),
  51                                 new Pared(780, 13, 10, 120),
  52                                 new Pared(780, 130, 90, 10),
  53                                 new Pared(700, 130, 90, 10),
  54                                 new Pared(870, 130, 10, 120),
  55                                 new Pared(820, 380, 180, 10),
  56                                 new Pared(820, 380, 10, 220),
  57                                 new Pared(740, 450, 80, 10),
  58                                 new Pared(820, 600, 80, 10),
  59                                 new Pared(920, 510, 80, 10),
  60                                 new Pared(970, 570, 30, 10),
  61                                 new Pared(950, 80, 50, 10),
  62                                 new Pared(950, 300, 50, 10),
  63                 };
  64                 for(int i = 0; i < paredes.length; i++){
  65                         l.add(paredes[i]);
  66                         paredes[i].setVisible(true);
  67                 }
  68                 
  69                 //Comida
  70                 Comida[] comidas = {
  71                                 new Comida (20, 500, 30, 20),
  72                                 new Comida (120,40, 30, 20),
  73                                 new Comida (280,300, 30, 20),
  74                                 new Comida (400,35, 30, 20),
  75                                 new Comida (500,645, 30, 20),
  76                                 new Comida (700,300, 30, 20),
  77                                 new Comida (870,480, 30, 20),
  78                                 new Comida (820,40, 30, 20),
  79                 };
  80                 for(int i =0; i < comidas.length; i++){
  81                         l.add(comidas[i]);
  82                         comidas[i].setVisible(true);
  83                 }
  84                 
  85                  //Pinguino
  86                 Pinguino pinguino=new Pinguino (900,400, 50, 60, l, paredes, comidas);
  87                 l.add(pinguino);
  88                 pinguino.setVisible(true);
  89                 
  90                                                 
  91                 // Fantasmas
  92                 Fantasma[] fantasma = new Fantasma[3];
  93                 Thread[] hiloFantasma = new Thread[3];
  94                 for(int i = 0; i < fantasma.length; i++){
  95                         fantasma[i] = new Fantasma (700 + i * 90, 250, 50, 60, pinguino, l, pinguino, paredes);
  96                         l.add(fantasma[i]);
  97                         fantasma[i].setVisible(true);
  98                         hiloFantasma[i] = new Thread(fantasma[i]);
  99                         hiloFantasma[i].start();
 100                 }
 101                 pinguino.add(fantasma);
 102 
 103                 //FantasmasEvolucion
 104                 FantasmaEvolucion[] fantasmaEvolucion = new FantasmaEvolucion[2];
 105                 Thread[] hiloFantasmaEvolucion = new Thread[2];
 106                 for(int i = 0; i < fantasmaEvolucion.length; i++){
 107                         fantasmaEvolucion[i] = new FantasmaEvolucion (155, 550, 50, 60, pinguino, l, paredes, pinguino);
 108                                                new FantasmaEvolucion (900, 60, 50, 60, pinguino, l, paredes, pinguino);
 109                         l.add(fantasmaEvolucion[i]);
 110                         fantasmaEvolucion[i].setVisible(true);
 111                         hiloFantasmaEvolucion[i] = new Thread(fantasmaEvolucion[i]);
 112                         hiloFantasmaEvolucion[i].start();                       
 113                 }
 114                 pinguino.add(fantasmaEvolucion);
 115                 
 116                 /*
 117                 //PoderDePinguino
 118                 PoderDePinguino poderDePinguino[];
 119                 poderDePinguino = new PoderDePinguino[2];
 120                 poderDePinguino[0] = new PoderDePinguino(25, 410, l);
 121                 poderDePinguino[0].setVisible(true);
 122                 poderDePinguino[1] = new PoderDePinguino(25, 410, l);
 123                 poderDePinguino[1].setVisible(true);
 124                 for (int i=0; i < poderDePinguino.length; i++){
 125                         l.add(poderDePinguino[i]);
 126                 }
 127                 */
 128                 
 129                 EscuchaTeclas escuchaTeclas = new EscuchaTeclas(pinguino, l, paredes);
 130                 marco.add(l);
 131                 marco.addKeyListener(escuchaTeclas);
 132                 
 133         //Luces,camara accion.
 134                 marco.setSize(1040,755);
 135                 marco.setVisible(true);
 136         }
 137 }

CategoryJava | CategoryProgramacion

Java/Programas/MazeDallcu/Interfaz.java (last edited 2008-11-13 15:12:29 by UldySoto)