-
Notifications
You must be signed in to change notification settings - Fork 11
/
generateClubBeach.ts
106 lines (93 loc) · 2.21 KB
/
generateClubBeach.ts
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
97
98
99
100
101
102
103
104
105
106
import { generate, type TileBox } from "./generate";
const meta = {
app: "gatherchat",
version: "1.0",
image: "clubbeach.png",
format: "RGBA8888",
size: { w: 1334, h: 1248 },
scale: "1",
// "smartupdate": "$TexturePacker:SmartUpdate:cd0d17d3f8965456a92be15158a0ed9e:d14942d54a3d3385fdb15258e1ae1a8f:cbce6b53f0f49e0bf15173c25c41f876$"
};
const tileSize = {
w: 32,
h: 32,
};
const sectionSize = {
x: 21,
y: 19,
}
const sectionNames = ["clubhouse1", "beach1"];
const floorSize = {
x: 5,
y: 4,
};
const floorName = (xyStr: string) => ({
'0_0': 'default',
'0_1': 'wall',
'1_0': 'deepwater',
'1_1': 'walkable',
})[xyStr];
const floors: TileBox[] = sectionNames.flatMap((sectionName, s) =>
Array.from(Array(2).keys()).flatMap((x) =>
Array.from(Array(2).keys()).flatMap((y) => {
const name = `${sectionName}_floor_${floorName(`${x}_${y}`)}`;
const rect = {
x: s * sectionSize.x + x * floorSize.x,
y: y * floorSize.y,
w: floorSize.x,
h: floorSize.y,
};
return { name, rect };
})
)
);
const couchesOffset = {
x: 1,
y: 8,
};
export const couchSize = {
x: 2,
y: 2,
};
const couches: TileBox[] = sectionNames.flatMap((sectionName, s) =>
Array.from(Array(3).keys()).flatMap((y) => {
const name = `${sectionName}_couch_${y}`;
const rect = {
x: s * sectionSize.x + couchesOffset.x,
y: couchesOffset.y + couchSize.y * y,
w: couchSize.x,
h: couchSize.y,
};
return { name, rect };
})
);
const rugsOffset = {
x: 0,
y: 15,
};
export const rugSize = {
x: 3,
y: 3,
};
const rugs: TileBox[] = sectionNames.flatMap((sectionName, s) =>
Array.from(Array(3).keys()).flatMap((x) => {
const name = `${sectionName}_rug_${x}`;
const rect = {
x: s * sectionSize.x + rugsOffset.x + rugSize.x * x,
y: rugsOffset.y,
w: rugSize.x,
h: rugSize.y,
};
return { name, rect };
})
);
const segmentTileBoxes: TileBox[] = [
...floors,
// TODO: Walls, etc
];
const blockFrameSets: TileBox[] = [
...couches,
...rugs,
// TODO: Plants, etc
];
export const generateClubBeach = () => generate("./public/assets/tiles/clubbeach.json", meta, tileSize, segmentTileBoxes, blockFrameSets);