| 1 | class GrassTiler extends GameObject |
| 2 | { |
| 3 | ground_light = null; |
| 4 | ground_dark = null; |
| 5 | |
| 6 | addedToScene () |
| 7 | { |
| 8 | this.ground_dark = this.scene.game.images.grass_dark; |
| 9 | this.ground_light = this.scene.game.images.grass_light; |
| 10 | } |
| 11 | |
| 12 | draw (context) |
| 13 | { |
| 14 | let width = this.scene.real_size.x + this.ground_dark.width; |
| 15 | let height = this.scene.real_size.y + this.ground_dark.height; |
| 16 | let size = 32; |
| 17 | let count = 0; |
| 18 | for (let x = 0; x < width; x += size) |
| 19 | { |
| 20 | for (let y = 0; y < height; y += size) |
| 21 | { |
| 22 | count++; |
| 23 | ((count) % 2 == 1 ? this.ground_dark : this.ground_light).draw(this.scene, x - (size / 2), y, size, size, 0, 0, 0, 1, 0); |
| 24 | } |
| 25 | |
| 26 | count = x / size % 2; |
| 27 | } |
| 28 | } |
| 29 | } |