Skip to content

Commit

Permalink
first Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Agus Alexander committed Nov 20, 2017
0 parents commit c2062db
Show file tree
Hide file tree
Showing 90 changed files with 1,685 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="E:/entorno(1).jar" sourcepath="C:/Users/Agus/Downloads/entorno.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Binary file added AliadoSeleccionado.wav
Binary file not shown.
Binary file added Ataque.wav
Binary file not shown.
Binary file added Conquistado.wav
Binary file not shown.
Binary file added Funky Ants.wav
Binary file not shown.
Binary file added HormigaMuerta.wav
Binary file not shown.
Binary file added LvlUp.wav
Binary file not shown.
Binary file added SobrePoblacion.wav
Binary file not shown.
Binary file added SpawnHormiga.wav
Binary file not shown.
Binary file added Teemo.wav
Binary file not shown.
Binary file added Transferir.wav
Binary file not shown.
Binary file added bin/CapaPasto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/EspadaP1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/EspadaP2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Flag0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Flag1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Flag2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/FlechaP1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/FlechaP2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/FondoBajaRes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Hormiga1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Hormiga1T.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Hormiga2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Hormiga2T.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Hormiguero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/HormigueroSelectP1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/HormigueroSelectP1P2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/HormigueroSelectP2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/HormigueroT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Jugar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/JugarFeo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Parche.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Resumir.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Teemoq.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Titulo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/fondo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/juego/Hormiga.class
Binary file not shown.
Binary file added bin/juego/Hormiguero.class
Binary file not shown.
Binary file added bin/juego/Juego.class
Binary file not shown.
Binary file added bin/juego/Jugador.class
Binary file not shown.
Binary file added bin/juego/Launcher$1.class
Binary file not shown.
Binary file added bin/juego/Launcher$2.class
Binary file not shown.
Binary file added bin/juego/Launcher$3.class
Binary file not shown.
Binary file added bin/juego/Launcher$4.class
Binary file not shown.
Binary file added bin/juego/Launcher$5.class
Binary file not shown.
Binary file added bin/juego/Launcher$6.class
Binary file not shown.
Binary file added bin/juego/Launcher.class
Binary file not shown.
Binary file added bin/juego/Teemo.class
Binary file not shown.
Binary file added bin/lvl2.png
Binary file added bin/lvl3.png
Binary file added bin/lvl4.png
Binary file added bin/teemo.gif
Binary file added entorno(1).jar
Binary file not shown.
Binary file added src/CapaPasto.png
Binary file added src/EspadaP1.png
Binary file added src/EspadaP2.png
Binary file added src/Flag0.png
Binary file added src/Flag1.png
Binary file added src/Flag2.png
Binary file added src/FlechaP1.png
Binary file added src/FlechaP2.png
Binary file added src/FondoBajaRes.jpg
Binary file added src/Hormiga1.png
Binary file added src/Hormiga1T.png
Binary file added src/Hormiga2.png
Binary file added src/Hormiga2T.png
Binary file added src/Hormiguero.png
Binary file added src/HormigueroSelectP1.png
Binary file added src/HormigueroSelectP1P2.png
Binary file added src/HormigueroSelectP2.png
Binary file added src/HormigueroT.png
Binary file added src/Jugar.png
Binary file added src/JugarFeo.png
Binary file added src/Parche.jpg
Binary file added src/Resumir.png
Binary file added src/Teemoq.png
Binary file added src/Titulo.jpg
Binary file added src/fondo.jpg
221 changes: 221 additions & 0 deletions src/juego/Hormiga.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
package juego;


import java.awt.Image;
import java.awt.Point;
import java.util.Random;

import entorno.*;

public class Hormiga{
int ataque,vida;
float x,y,destinox,destinoy,pendiente,ordenada,velocidad,velocidadanterior;
boolean infeccion,EnMovimiento,select,Activada;
double direccion,direccionr;
private Image Hormi2=Herramientas.cargarImagen("Hormiga1.png");
private Image Hormi2Infectada=Herramientas.cargarImagen("Hormiga1T.png");
private Image Hormi1=Herramientas.cargarImagen("Hormiga2.png");
private Image Hormi1Infectada=Herramientas.cargarImagen("Hormiga2T.png");
Jugador jugador;
Hormiguero Hormiguero;
Point Destino;




public Hormiga(Jugador jugador,Hormiguero Hormiguero){
this.jugador=jugador;
this.Hormiguero=Hormiguero;
this.x=Hormiguero.x;
this.y=Hormiguero.y;
this.Destino=new Point((int)this.x,(int)this.y);
this.EnMovimiento=false;
this.select=false;
this.Activada=false;
this.pendiente=0;
this.ordenada=0;
if (this.jugador==Juego.Jugador1){
this.direccionr=Herramientas.radianes(270);} //Direccion inical

else if (this.jugador==Juego.Jugador2){
this.direccionr=Herramientas.radianes(90);}//Direccion inicial
this.vida=1;
this.infeccion=false;
Random ran = new Random();
this.velocidad=(float)(ran.nextFloat()+0.4);
this.ataque=1;
}


public void refrescaHormiga(Entorno entorno){
//seleccion y Ataque




if ((this.jugador.Ataque==true)&(this.Hormiguero.select)){this.Activada=true;}// Si el jugador ataca, se desbloquea el segundo select

if((this.select)&(this.Activada)){ //Si la hormiga esta en un hormi select y ademas el jugador ataca

if(this.Hormiguero.getObjetivo()!=null){ //La Hormiga recibe un objetivo
/*Hormiguero hf=new Hormiguero(this.jugador,(int)this.x,(int)this.y);
if(!Juego.Hormiselect(hf,this.Hormiguero.getObjetivo(),10)){*/

this.setDestino(this.Hormiguero.getObjetivo());
}}




//Dibujo
if((this.EnMovimiento)||(!this.enHormiguero())){ //SI se esta moviendo la dibuja
this.select=true;
if(this.infeccion){
if (this.jugador==Juego.Jugador1){
entorno.dibujarImagen(Hormi1Infectada, this.x, this.y, this.direccionr,0.5);}
else if (this.jugador==Juego.Jugador2){
entorno.dibujarImagen(Hormi2Infectada, this.x, this.y, this.direccionr,0.5);
}}

else if(!this.infeccion){
if (this.jugador==Juego.Jugador1){
entorno.dibujarImagen(Hormi1, this.x, this.y, this.direccionr,0.5);}
else if (this.jugador==Juego.Jugador2){
entorno.dibujarImagen(Hormi2, this.x, this.y, this.direccionr,0.5);}}}

else{this.Activada=false;} //Sino la "desactiva" asi no se mueven solas las nuevas hormis que se generan


}


public void pesteTeemo(){
Teemo[] timos=Juego.Gaia.getTeemos();

for(int z=0;z<timos.length;z++){
if (timos[z]!=null){
int cat1=(int) Math.abs(timos[z].x-this.x);
int cat2=(int) Math.abs(timos[z].y-this.y);
double Distancia=Math.sqrt(((cat1)*(cat1))+((cat2)*(cat2)));
if ((Distancia<=timos[z].diametro*2)){
if (!this.infeccion){
this.infeccion=true;
this.velocidad/=2;
return;}
if(this.infeccion){return;}}}}
if(this.infeccion){this.infeccion=false;this.velocidad*=2;}
}


public void mueveHormiga(){


if ((Math.abs(this.x-this.Destino.x)>1)||(Math.abs(this.y-this.Destino.y)>1)){
if ((!this.EnMovimiento)&(enHormiguero())){
if(Math.abs(Juego.contTicks-Juego.UltimoSpawn)>10){
Juego.UltimoSpawn=Juego.contTicks;
Herramientas.play("SpawnHormiga.wav");}
}
this.EnMovimiento=true;

float catx=(this.Destino.x-this.x);
float caty=(this.Destino.y-this.y);
float h=(float)Math.sqrt(catx*catx+caty*caty);
this.x+=(catx*this.velocidad)/h;
this.y+=(caty*this.velocidad)/h;


if ((catx>=0)&(caty>=0)){
this.direccionr=Math.asin(caty/h)+Math.toRadians(90);
}

if ((catx<0)&(caty>0)){
this.direccionr=Math.acos(caty/h)+Math.toRadians(180);
}

if ((catx<0)&(caty<0)){
this.direccionr=Math.acos(caty/h)+Math.toRadians(180);
}

if ((catx>0)&(caty<0)){
this.direccionr=Math.asin(caty/h)+Math.toRadians(90);
}



}
else{
this.EnMovimiento=false;
}

this.pesteTeemo();// revisa que no este en una mancha

}


public boolean enHormiguero(){ //Si esta en el hormiguero
if(Juego.Hormiselect(this.Hormiguero,new Point((int)this.x,(int)this.y),0)){
return true;
}
return false;
}

public Point getDestino() {
return new Point((int)this.destinox,(int)this.destinoy);
}
public void setDestino(Point Destino1) {
this.Destino=Destino1;
}
public void MatarHormiga(){



for(int x=0;x<this.Hormiguero.Hormigas.length;x++){

if (this==this.Hormiguero.Hormigas[x]){

this.Hormiguero.Hormigas[x]=null;
return;
}
}
}


}





































Loading

0 comments on commit c2062db

Please sign in to comment.