-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLaminaria.java
More file actions
87 lines (77 loc) · 1.86 KB
/
Laminaria.java
File metadata and controls
87 lines (77 loc) · 1.86 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package q3;
//ofri rom:208891804
//avigail shekasta:209104314
import java.awt.*;
public class Laminaria extends Immobile{
int size;
int x;
int y;
public Color colorr = Color.GREEN;
public Laminaria(int size,int x,int y){
/**
* constructor
*/
super("Laminaria");
this.size=size;
this.x=x;
this.y=y;
}
@Override
public memento saveStateToMemento() {
return new memento("Zostera",size,x, y);
}
@Override
public void getStateFromMemento(memento m) {
size=m.get_size();
x=m.get_x_front();
y=m.get_y_front();
colorr=m.get_Colorr();
}
public void draw(Graphics g){
/**
* draw the planet on the panel
*/
g.setColor(colorr);
g.fillArc(x-size/20,y-size,size/10,size*4/5,0,360);
g.fillArc(x-size*3/20,y-size*13/15,size/10,size*2/3,0,360);
g.fillArc(x+size/20,y-size*13/15,size/10,size*2/3,0,360);
g.drawLine(x,y,x,y-size/5);
g.drawLine(x,y,x-size/10,y-size/5);
g.drawLine(x,y,x+size/10,y-size/5);
}
@Override
public void drawCreature(Graphics g) {
/**
* call the draw method via the interface
*/
draw(g);
}
public Laminaria(){
/**
* super constructor
*/
super("Laminaria");
}
@Override
public void set_obj(int size, int x, int y) {
/**
* set the object parameters
*/
name="Laminaria";
this.size=size;
this.x=x;
this.y=y;
}
@Override
public int get_size() {
return size;
}
@Override
public int get_x() {
return x;
}
@Override
public int get_y() {
return y;
}
}