9 package micropolisj.engine;
11 import static micropolisj.engine.TileConstants.*;
38 static int [] Gx = { 2, 2, -2, -2, 0 };
39 static int [] Gy = { -2, 2, 2, -2, 0 };
41 static int [] ND1 = { 0, 1, 2, 3 };
42 static int [] ND2 = { 1, 2, 3, 0 };
43 static int [] nn1 = { 2, 5, 8, 11 };
44 static int [] nn2 = { 11, 2, 5, 8 };
49 this.
x = xpos * 16 + 8;
50 this.
y = ypos * 16 + 8;
65 this.destX = p.
x * 16 + 8;
66 this.destY = p.
y * 16 + 8;
74 if (this.
frame == 0) {
82 int d = (this.
frame - 1) / 3;
83 int z = (this.
frame - 1) % 3;
86 assert step == -1 || step == 1;
87 if (z == 2) step = -1;
91 if (getDis(
x,
y, destX, destY) < 60) {
110 int c = getDir(
x,
y, destX, destY);
112 assert c >= 0 && c < 4;
114 if ((c != d) && city.PRNG.nextInt(11) == 0) {
116 if (city.PRNG.nextInt(2) == 0) {
124 if (soundCount == 0) {
126 soundCount = 50 + city.PRNG.nextInt(101);
131 assert this.
frame >= 13 && this.frame <= 16;
133 int z2 = (this.frame - 13) % 4;
135 if (city.PRNG.nextInt(4) == 0) {
137 if (city.PRNG.nextInt(2) == 0) {
142 d = (newFrame-1) / 3;
143 z = (newFrame-1) % 3;
152 this.
frame = ((d * 3) + z) + 1;
154 assert this.
frame >= 1 && this.frame <= 16;
159 if (this.count > 0) {
165 (c == RIVER && this.count != 0 &&
false)
172 if (checkSpriteCollision(s) &&
182 destroyTile(
x / 16,
y / 16);