|
1234567891011121314151617181920 |
- export default class Tile {
- constructor(x, y, name) {
- this.x = x;
- this.y = y;
- this.name = name;
- }
- }
-
- Tile.createLine = function(width, name) {
- if (width <= 1) {
- return [ new Tile(0, 0, name+"-lr") ];
- } else {
- return [
- new Tile(0, 0, name+"-l"),
- Array.from({ length: width - 2 }, (_, i) =>
- new Tile(i + 1, 0, name)),
- new Tile(width - 1, 0, name+"-r"),
- ];
- }
- }
|