Advertisement
zacmaster

Todo_Arreglos

Jun 3rd, 2015
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.32 KB | None | 0 0
  1. package juego;
  2. import entorno.Entorno;
  3. //import java.util.Random;
  4. public class Todo_Arreglos {
  5. //    private int cantidad;
  6.     private Zombie[] zombies;
  7.     private Torreta[] torretas;
  8.     private TorretaLaser[] torretasLaser;
  9. //    private Mina[] minas;
  10.    
  11.     public Todo_Arreglos() {
  12.     }
  13.    
  14.     public Zombie[] getZombies() {
  15.         return zombies;
  16.     }
  17.     public void setZombies(Zombie[] zombies) {
  18.         this.zombies = zombies;
  19.     }
  20.    
  21.     public Torreta[] getTorretas() {
  22.         return torretas;
  23.     }
  24.     public void setTorretas(Torreta[] torretas) {
  25.         this.torretas = torretas;
  26.     }
  27.    
  28.     public TorretaLaser[] getTorretasLaser() {
  29.         return torretasLaser;
  30.     }
  31.     public void setTorretasLaser(TorretaLaser[] torretasLaser) {
  32.         this.torretasLaser = torretasLaser;
  33.     }
  34. //    
  35. //  public Mina[] getMinas() {
  36. //        return minas;
  37. //    }
  38. //    public void setMinas(Mina[] minas) {
  39. //        this.minas = minas;
  40. //    }
  41. //    
  42.    
  43.    
  44. //   ----------------------------------------------------------------------------------------------------------
  45.    
  46.  
  47.  
  48.    
  49.     public void Arr_Zombie(int cantidad) {
  50.         this.zombies = new Zombie[cantidad];        
  51.         for(int i=0;i<cantidad;i++){
  52.             zombies[i]= new Zombie();            
  53.         }        
  54.     }
  55.    
  56.     public void Arr_Torreta(int cantidad) {        
  57.         this.torretas = new Torreta[cantidad];        
  58.         for(int i=0;i<cantidad;i++){
  59.             torretas[i]= new Torreta();            
  60.         }
  61.     }
  62.    
  63.     public void Arr_TorretaLaser(int cantidad) {        
  64.         this.torretasLaser = new TorretaLaser[cantidad];        
  65.         for(int i=0;i<cantidad;i++){
  66.             torretasLaser[i]= new TorretaLaser();            
  67.         }
  68.     }
  69. //    public void Arr_Mina(int cantidad){
  70. //        this.minas = new Mina[cantidad];
  71. //        for (int i = 0; i < cantidad; i++) {
  72. //            minas[i] = new Mina();
  73. //        }
  74. //    }
  75.        
  76.     public void avanzarZombie(){        
  77.         for (int i = 0; i < zombies.length; i++) {
  78.                 zombies[i].avanzar();    
  79.            
  80.            
  81.         }
  82.     }
  83.     public void dibujarZombie(Entorno entorno){
  84.         for (int i = 0; i < zombies.length; i++) {
  85. //            System.out.println(i+" "+zombies[i].isVivo());
  86.             if (zombies[i].isVivo() == true) {
  87.                 zombies[i].dibujarse(entorno);
  88.             }            
  89.         }
  90.     }
  91.    
  92.     public void dibujarTorreta(Entorno entorno){
  93.         for (int i = 0; i < torretas.length; i++) {
  94.             if (torretas[i].isVivo() == true){
  95.                 torretas[i].dibujarse(entorno);
  96.             }
  97.                            
  98.         }
  99.     }
  100.    
  101.  
  102. //    public void dibujarTorretaLaser(Entorno entorno){
  103. //        for (int i = 0; i < torretasLaser.length; i++) {
  104. //            if (torretasLaser[i].isVivo() == true){
  105. //                torretasLaser[i].dibujarse(entorno);
  106. //            }
  107. //                            
  108. //        }
  109. //    }
  110. //
  111. //    
  112. //    public void dibujarMina(Entorno entorno){
  113. //        for (int i = 0; i < minas.length; i++) {
  114. //            if (minas[i].isVivo() && minas[i].getX() != -50 && minas[i].getY() != -50) {
  115. //                minas[i].dibujarse(entorno);
  116. //            }
  117. //        }
  118. //    }
  119.    
  120.    
  121. //    public void MismaPosicion(){
  122. //        for (int i = 0; i < torretas.length; i++) {
  123. //            if (distanciaObjetoObjeto()>=
  124. //            torretas[i].getAlto()/2+torretas[i].getAlto()/2)){
  125. //                
  126. //            }
  127. //        }
  128. //    }
  129.    
  130.    
  131.    
  132.     static double distanciaObjetoObjeto(double x1,double y1,double x2, double y2){
  133.         double distancia;
  134.         distancia = Math.pow((Math.pow((x2-x1), 2)+Math.pow((y2-y1), 2)), 0.5);
  135.         return distancia;
  136.     }
  137. //    public boolean vencida(){
  138. //        int c = 0;
  139. //        for (int i = 0; i < zombies.length; i++) {
  140. //            if (zombies[i].isVivo() == false) {
  141. //                c++;
  142. //            }        
  143. //        }
  144. //        if (c == cantidad){
  145. //            return true;
  146. //        }
  147. //        return false;
  148. //    }
  149. //    public boolean conElementos(){
  150. //        if(zombies.length>0){
  151. //            return true;
  152. //        }
  153. //        return false;
  154. //    }
  155. //    
  156.        
  157.    
  158.  
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement