-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTierra.java
61 lines (43 loc) · 1.63 KB
/
Tierra.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package hilos;
import java.util.ArrayList;
import javax.swing.Icon;
import javax.swing.JPanel;
/**
*
* @author abel
*/
public class Tierra extends Ser {
public Tierra(String especie,Icon imagenCria,Icon imagenAdulto,boolean hembra,JPanel panel,ArrayList colonia,
int esperanzadevida,int limiteedadreproduccion,int edadadulta,int limitedescendientes,
int traslacion,int hambre
)
{super( especie,null,imagenCria,imagenAdulto,hembra,panel,colonia,
esperanzadevida,limiteedadreproduccion,edadadulta,0,0,esperanzadevida);
}
public Object clone(){
Tierra tierra= new Tierra(especie,imagenCria,imagenAdulto,hembra,panel,colonia,
esperanzadevida,limiteedadreproduccion,edadadulta,limitedescendientes,traslacion,hambre);
tierra.x+=10-(int)random.nextFloat()*20;
tierra.y+=10-(int)random.nextFloat()*20;
return tierra;
}
public void reproducete(Ser otro){;}
public void alimentate(Ser otro){;}
public void muere() {
try {
colonia.remove(this);
panel.remove(label);
label.setVisible(false);
if (timer!=null)timer.cancel();
if (timer1!=null) timer1.cancel();
panel.validate();
finalize();
} catch (Throwable ex) {ex.printStackTrace();
}
}
}