Add background entities
Getty Ritter
7 years ago
16 | 16 | -- draw the entities |
17 | 17 | for x = 0, consts.boardWidth - 1 do |
18 | 18 | for y = 0, consts.boardHeight - 1 do |
19 | -- if an entity is in this space, draw it | |
20 | local e = state.board:lookupEntity(x, y) | |
21 | if e and e.behind then | |
22 | e:draw(x, y, state.t) | |
23 | end | |
24 | end | |
25 | end | |
26 | ||
27 | -- draw the entities | |
28 | for x = 0, consts.boardWidth - 1 do | |
29 | for y = 0, consts.boardHeight - 1 do | |
19 | 30 | -- if the character is in this space, draw it first |
20 | 31 | -- XXX: extend this to mobile entities in general |
21 | 32 | local sX, sY = state.char:gameCoords() |
22 | 33 | if sX == x and sY == y then |
23 | 34 | state.char:draw() |
24 | 35 | end |
36 | ||
25 | 37 | -- if an entity is in this space, draw it |
26 | 38 | local e = state.board:lookupEntity(x, y) |
27 |
if e |
|
39 | if e and not e.behind then | |
40 | e:draw(x, y, state.t) | |
41 | end | |
28 | 42 | end |
29 | 43 | end |
30 | 44 |
6 | 6 | {"grass"}, {"water"}, {"grass"}, {"stonepath"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"stonepath"}, {"grass"}, {"grass"}, |
7 | 7 | {"grass"}, {"water"}, {"grass"}, {"stonepath"}, {"grass"}, {"grass"}, {"grass", "sign"}, {"stonepath"}, {"stonepath"}, {"stonepath"}, {"stonepath"}, {"stonepath"}, {"stonepath"}, {"stonepath"}, {"grass"}, {"grass"}, |
8 | 8 | {"water"}, {"water"}, {"grass"}, {"stonepath"}, {"stonepath"}, {"stonepath"}, {"stonepath"}, {"stonepath"}, {"grass"}, {"grass", "sign", signText="This is an example of entity-specific\ninformation contained in the map file."}, {"grass"}, {"grass"}, {"grass", "tree_upper"}, {"grass"}, {"grass"}, {"grass"}, |
9 | {"water"}, {"grass"}, {"grass"}, {"stonepath"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass", "tree_lower"}, {"grass", "tree_upper"}, {"grass"}, {"grass"}, | |
10 | {"water"}, {"grass"}, {"grass"}, {"stonepath"}, {"grass"}, {"grass"}, {"grass"}, {"flowergrass"}, {"grass"}, {"flowergrass"}, {"grass"}, {"grass"}, {"grass"}, {"grass", "tree_lower"}, {"grass"}, {"grass"}, | |
9 | {"water"}, {"grass"}, {"grass"}, {"stonepath"}, {"grass", "pinkflower"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass", "tree_lower"}, {"grass", "tree_upper"}, {"grass"}, {"grass"}, | |
10 | {"water"}, {"grass"}, {"grass"}, {"stonepath"}, {"grass"}, {"grass"}, {"grass", "pinkflower"}, {"flowergrass"}, {"grass"}, {"flowergrass"}, {"grass"}, {"grass"}, {"grass"}, {"grass", "tree_lower"}, {"grass"}, {"grass"}, | |
11 | 11 | {"grass"}, {"stonepath"}, {"stonepath", "lamp_upper"}, {"stonepath"}, {"grass"}, {"grass"}, {"flowergrass"}, {"grass"}, {"flowergrass"}, {"grass"}, {"grass"}, {"grass"}, {"flowergrass"}, {"grass"}, {"grass"}, {"grass"}, |
12 | 12 | {"grass"}, {"stonepath"}, {"stonepath", "lamp_lower" }, {"stonepath"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"flowergrass"}, {"grass"}, {"grass"}, |
13 | 13 | {"grass"}, {"stonepath"}, {"stonepath"}, {"stonepath"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, {"grass"}, |
1 | 1 | { |
2 |
pass = |
|
2 | pass = true, | |
3 | behind = true, | |
3 | 4 | name = 'house_sc', |
4 | 5 | spriteX = 30, |
5 | 6 | spriteY = 2, |
Binary diff not shown
Binary diff not shown