class GrassTiler extends GameObject { ground_light = null; ground_dark = null; addedToScene() { this.ground_dark = this.scene.game.images.grass_dark; this.ground_light = this.scene.game.images.grass_light; } draw(context) { let width = this.scene.real_size.x + this.ground_dark.width let height = this.scene.real_size.y + this.ground_dark.height let count = 0; for(let x = 0; x < width; x += this.ground_dark.width) { for(let y = 0; y < height; y += this.ground_light.height) { count++; ((count) %2 == 1? this.ground_dark : this.ground_light).draw(this.scene, 0, 0, this.ground_dark.width, this.ground_dark.height, x, y, this.ground_dark.width, this.ground_light.height, 0, 1) } count = x/64 % 2; } } }