-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorldObject.java
More file actions
52 lines (45 loc) · 883 Bytes
/
WorldObject.java
File metadata and controls
52 lines (45 loc) · 883 Bytes
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
import processing.core.PImage;
import java.util.List;
import java.util.Iterator;
public class WorldObject
{
private String name;
private List<PImage> imgs;
private Iterator<PImage> iter;
private PImage currentImg;
public WorldObject(String name, List<PImage> imgs)
{
this.name = name;
this.imgs = imgs;
this.iter = imgs.iterator();
nextImage();
}
public String getName()
{
return this.name;
}
public String toString()
{
return "unknown";
}
public PImage getImage()
{
return currentImg;
}
public void nextImage()
{
if (iter.hasNext())
{
this.currentImg = iter.next();
}
else
{
this.iter = this.imgs.iterator();
this.currentImg = iter.next();
}
}
protected List<PImage> getImages()
{
return imgs;
}
}