-
Notifications
You must be signed in to change notification settings - Fork 0
/
tileset.lua
151 lines (114 loc) · 3.12 KB
/
tileset.lua
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
--[[
tileset.lua
Provides a list of constants to use the tileset efficiently. The tileset is laid out
with 88 unique tiles for each of 30 palettes. Each tile ID is relative to the
palette it's in, rather than the absolute tile ID used by the game. Converting to
an absolute tile ID looks like this:
last base tile ID [to get to the custom tileset] +
(current palette - 1) *
number of tiles per palette [to get to the current palette] +
relative tile ID
Cells in level.lua perform this calculation automatically as needed; you normally
shouldn't have to calculate this yourself.
Some tiles have alternate styles, which can be switched between by adding the
corresponding alt offset to the base tile ID:
EXAMPLE_TILE + EXAMPLE_ALT_OFFSET
]]
-- Points to the last base tile before the custom tileset begins
CUSTOM_TILES_OFFSET = 220
-- Number of palettes in the tileset
PALETTES = 30
-- Number of unique tiles in each palette
TILES_PER_PALETTE = 88
-- The first 44 tiles in each palette are solid; the rest are not
LAST_SOLID_TILE = 44
--[[
Foreground tiles (solid)
]]
-- There are eight variations of ground tiles to choose from
FIRST_GROUND_TILE = 1
LAST_GROUND_TILE = 8
-- There are eight variations of block tiles to choose from
FIRST_BLOCK_TILE = 9
LAST_BLOCK_TILE = 16
-- Two styles of bricks can be switched with the alt offset
BRICK_TOP = 17
BRICK_CENTER = 15
BRICK_ALT_OFFSET = 1
-- Pipes
VERTICAL_PIPE_LEFT_SPOUT = 19
VERTICAL_PIPE_RIGHT_SPOUT = 20
VERTICAL_PIPE_LEFT_BASE = 21
VERTICAL_PIPE_RIGHT_BASE = 22
HORIZONTAL_PIPE_UPPER_SPOUT = 23
HORIZONTAL_PIPE_LOWER_SPOUT = 24
HORIZONTAL_PIPE_UPPER_BASE = 25
HORIZONTAL_PIPE_LOWER_BASE = 26
BLASTER_TOP = 27
BLASTER_MOUNT = 28
BLASTER_BASE = 29
CLOUD_PLATFORM_LEFT = 30
CLOUD_PLATFORM_CENTER = 31
CLOUD_PLATFORM_RIGHT = 32
-- Two styles of treetops can be switched with the alt offset
TREETOPS_LEFT = 33
TREETOPS_CENTER = 34
TREETOPS_RIGHT = 35
TREETOPS_ALT_OFFSET = 3
MUSHROOM_PLATFORM_LEFT = 39
MUSHROOM_PLATFORM_CENTER = 40
MUSHROOM_PLATFORM_RIGHT = 41
SKY_BRIDGE = 42
SKY_BRIDGE_ALT_OFFSET = 1
CASTLE_BRIDGE = 44
--[[
Background tiles (not solid)
]]
TREETOPS_BASE = 45
TREETOPS_BASE_ALT_OFFSET = 1
TREETOPS_NUM_ALTS = 2
MUSHROOM_PLATFORM_STALK = 48
MUSHROOM_PLATFORM_BASE = 69
SKY_BRIDGE_ROPE = 49
CASTLE_BRIDGE_CHAIN = 50
FLAGPOLE = 51
FLAGPOLE_TOP = 52
HILL_TOP = 53
HILL_LEFT = 54
HILL_RIGHT = 55
HILL_TREES = 56
HILL_TREES_ALT_OFFSET = 1
HILL_INSIDE = 58
LAVA_TOP = 59
LAVA_CENTER = 58
BUSH_LEFT = 60
BUSH_CENTER = 61
BUSH_RIGHT = 62
CLOUD_UPPER_LEFT = 60
CLOUD_UPPER_CENTER = 61
CLOUD_UPPER_RIGHT = 62
CLOUD_LOWER_LEFT = 63
CLOUD_LOWER_CENTER = 64
CLOUD_LOWER_RIGHT = 65
BG_TREE_BASE = 66
SMALL_BG_TREE = 67
LARGE_BG_TREE_UPPER = 68
LARGE_BG_TREE_CENTER = 69
LARGE_BG_TREE_LOWER = 70
BG_TREE_ALT_OFFSET = 4
FENCE = 75
CASTLE_TOP = 76
CASTLE_LEFT_WINDOW = 77
CASTLE_WALL = 78
CASTLE_RIGHT_WINDOW = 79
CASTLE_RAMPART = 80
CASTLE_DOORWAY = 81
CASTLE_ALT_OFFSET = 7
DOOR = 82
--[[
Tiles from the base tileset; unlike the others in this file, these are absolute
tile IDs. To use these in a cell from level.lua, set the palette to 0.
]]
BLANK = 1
PRIZE_BLOCK = 8
COIN = 116