-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElement.java
More file actions
49 lines (42 loc) · 1.1 KB
/
Element.java
File metadata and controls
49 lines (42 loc) · 1.1 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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* The element picture displaying air, water, fire, earth
*
* @author James Lu
* @version 1.0
*/
public class Element extends DummyImage
{
private GreenfootImage[] element;
private int id;
public Element(){
bg = new GreenfootImage ("UI/a.png");
element = new GreenfootImage[5];
element[0] = new GreenfootImage (1,1);
element[1] = new GreenfootImage ("UI/a.png");
element[2] = new GreenfootImage ("UI/w.png");
element[3] = new GreenfootImage ("UI/f.png");
element[4] = new GreenfootImage ("UI/e.png");
id = 0;
bg.fill();
}
/**
* Sets the element <br>
* 0 is nothing <br>
* 1 is air <br>
* 2 is water <br>
* 3 is fire <br>
* 4 is earth
*/
public void setId (int i){
id = i;
bg = element[id];
}
/**
* Returns the id of this element image <br>
* Returns the numerical value of the current displayed element
*/
public int getId(){
return id;
}
}