Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package juego;
- import entorno.Entorno;
- //import java.util.Random;
- public class Todo_Arreglos {
- // private int cantidad;
- private Zombie[] zombies;
- private Torreta[] torretas;
- private TorretaLaser[] torretasLaser;
- // private Mina[] minas;
- public Todo_Arreglos() {
- }
- public Zombie[] getZombies() {
- return zombies;
- }
- public void setZombies(Zombie[] zombies) {
- this.zombies = zombies;
- }
- public Torreta[] getTorretas() {
- return torretas;
- }
- public void setTorretas(Torreta[] torretas) {
- this.torretas = torretas;
- }
- public TorretaLaser[] getTorretasLaser() {
- return torretasLaser;
- }
- public void setTorretasLaser(TorretaLaser[] torretasLaser) {
- this.torretasLaser = torretasLaser;
- }
- //
- // public Mina[] getMinas() {
- // return minas;
- // }
- // public void setMinas(Mina[] minas) {
- // this.minas = minas;
- // }
- //
- // ----------------------------------------------------------------------------------------------------------
- public void Arr_Zombie(int cantidad) {
- this.zombies = new Zombie[cantidad];
- for(int i=0;i<cantidad;i++){
- zombies[i]= new Zombie();
- }
- }
- public void Arr_Torreta(int cantidad) {
- this.torretas = new Torreta[cantidad];
- for(int i=0;i<cantidad;i++){
- torretas[i]= new Torreta();
- }
- }
- public void Arr_TorretaLaser(int cantidad) {
- this.torretasLaser = new TorretaLaser[cantidad];
- for(int i=0;i<cantidad;i++){
- torretasLaser[i]= new TorretaLaser();
- }
- }
- // public void Arr_Mina(int cantidad){
- // this.minas = new Mina[cantidad];
- // for (int i = 0; i < cantidad; i++) {
- // minas[i] = new Mina();
- // }
- // }
- public void avanzarZombie(){
- for (int i = 0; i < zombies.length; i++) {
- zombies[i].avanzar();
- }
- }
- public void dibujarZombie(Entorno entorno){
- for (int i = 0; i < zombies.length; i++) {
- // System.out.println(i+" "+zombies[i].isVivo());
- if (zombies[i].isVivo() == true) {
- zombies[i].dibujarse(entorno);
- }
- }
- }
- public void dibujarTorreta(Entorno entorno){
- for (int i = 0; i < torretas.length; i++) {
- if (torretas[i].isVivo() == true){
- torretas[i].dibujarse(entorno);
- }
- }
- }
- // public void dibujarTorretaLaser(Entorno entorno){
- // for (int i = 0; i < torretasLaser.length; i++) {
- // if (torretasLaser[i].isVivo() == true){
- // torretasLaser[i].dibujarse(entorno);
- // }
- //
- // }
- // }
- //
- //
- // public void dibujarMina(Entorno entorno){
- // for (int i = 0; i < minas.length; i++) {
- // if (minas[i].isVivo() && minas[i].getX() != -50 && minas[i].getY() != -50) {
- // minas[i].dibujarse(entorno);
- // }
- // }
- // }
- // public void MismaPosicion(){
- // for (int i = 0; i < torretas.length; i++) {
- // if (distanciaObjetoObjeto()>=
- // torretas[i].getAlto()/2+torretas[i].getAlto()/2)){
- //
- // }
- // }
- // }
- static double distanciaObjetoObjeto(double x1,double y1,double x2, double y2){
- double distancia;
- distancia = Math.pow((Math.pow((x2-x1), 2)+Math.pow((y2-y1), 2)), 0.5);
- return distancia;
- }
- // public boolean vencida(){
- // int c = 0;
- // for (int i = 0; i < zombies.length; i++) {
- // if (zombies[i].isVivo() == false) {
- // c++;
- // }
- // }
- // if (c == cantidad){
- // return true;
- // }
- // return false;
- // }
- // public boolean conElementos(){
- // if(zombies.length>0){
- // return true;
- // }
- // return false;
- // }
- //
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement