diff --git a/src/levels/rooftop.js b/src/levels/rooftop.js new file mode 100644 index 0000000..6879c1e --- /dev/null +++ b/src/levels/rooftop.js @@ -0,0 +1,37 @@ +// Seed #3: the rooftop. The cat starts on the left roof, a water tower stands on the right roof. +// Roof tops are one-way platforms. The door on the left roof leads down to the lobby; walk off the left edge for the alley. +import { PAL } from "../palette.js"; +import { blit } from "../sprites.js"; + +const BLOCKS = [ + { x: 0, y: 96, w: 80, h: 84, rows: 5 }, + { x: 86, y: 128, w: 62, h: 52, rows: 3 }, + { x: 154, y: 114, w: 60, h: 66, rows: 4 }, + { x: 222, y: 92, w: 98, h: 88, rows: 5 }, +]; + +export default { + name: "rooftop", + label: "rooftop", + platforms: BLOCKS.map((b) => ({ x: b.x, y: b.y, w: b.w })), + start: { x: 30, y: 90 }, + bossAt: { x: 262, y: 92 }, + exits: { left: { to: "alley", at: { x: 300, y: 150 } } }, + doors: [{ x: 52, y: 84, to: "lobby", at: { x: 40, y: 150 } }], + boss: null, + spawn: [], + music: "rooftop-a", + draw(g) { + for (const b of BLOCKS) { + g.fillStyle = PAL.wall; g.fillRect(b.x, b.y, b.w, b.h); + g.fillStyle = PAL.roof; g.fillRect(b.x - 1, b.y, b.w + 2, 4); + g.fillStyle = PAL.ink; g.fillRect(b.x - 1, b.y + 4, b.w + 2, 1); + let i = (b.x * 7) % 5; + for (let r = 0; r < b.rows; r++) for (let x = b.x + 8; x < b.x + b.w - 8; x += 14) { + i++; g.fillStyle = i % 3 === 0 ? PAL.winOff : PAL.light; + g.fillRect(x, b.y + 12 + r * 16, 7, 9); g.fillStyle = PAL.ink; g.fillRect(x + 3, b.y + 12 + r * 16, 1, 9); + } + } + blit(g, "tower", 282, 70); + }, +};