-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSkyTile.pde
96 lines (79 loc) · 2.18 KB
/
SkyTile.pde
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
88
89
90
91
92
93
94
95
96
class SkyTile extends ProceduralAnimatedGridTile
{
int tileColor = 0;
boolean is_right = false;
boolean is_left = false;
boolean is_top = false;
boolean is_cloudlayer = false;
int upx;
int upy;
void setTileColor()
{
tileColor = color(135,206,235);
}
//***************************************************************
//origin construtor
//***************************************************************
public SkyTile(int x, int y)
{
super(x,y);
setTileColor();
}
//***************************************************************
// XML constructor
//***************************************************************
public SkyTile(XML xml)
{
super(xml);
setTileColor();
}
//***************************************************************
// actually draw this tile
//***************************************************************
public void draw()
{
float[][] bases = gridTiles.getBasisVectors();
dg.pushStyle();
dg.noStroke();
dg.fill(tileColor);
dg.beginShape(TRIANGLE_STRIP);
dg.vertex(0, 0);
dg.vertex(bases[0][0], bases[0][1]);
dg.vertex(bases[1][0], bases[1][1]);
dg.vertex(bases[0][0] + bases[1][0], bases[0][1] + bases[1][1]);
dg.endShape();
dg.popStyle();
}
//***************************************************************
// update tick
//***************************************************************
public void update(float dt)
{
}
//***************************************************************
// load with XML
//***************************************************************
void loadWithXML(XML xml)
{
super.loadWithXML(xml);
println("XML: Initializing " + this.getClass().getName());
if (xml.hasAttribute("isright"))
{
is_right = true;
}
if (xml.hasAttribute("isleft"))
{
is_left = true;
}
if (xml.hasAttribute("isTop"))
{
is_top = true;
}
boolean has_upx;
boolean has_upy;
has_upx = xml.hasAttribute("upx");
has_upy = xml.hasAttribute("upy");
// if we only have one of these there's an error
//if (has_upx ^ has_upy)
}
}