123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- -- title: isoshit
- -- author: pixelbath
- -- desc: isometric stuff
- -- script: lua
- -- references: The Immortal (NES), Solstice (NES)
- t=0
- p = {
- x = -140,
- y = -20,
- spr = 0,
- }
- skeleton = {
- spr = 256,
- x = 3, y = 4,
- }
- map = {
- { 2, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 2, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 2, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 2, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0 },
- }
- function handle_mouse()
- local mx, my, pl, pm, pr = mouse()
- end
- function map2screen(mapx, mapy)
- return (mapx-mapy-1) * 8 - p.x, (mapx+mapy-1) * 4 - p.y
- end
- function drawTiles()
- for ky,yt in pairs(map) do
- for kx,xt in pairs(yt) do
- xtile, ytile = map2screen(kx, ky)
- spr(map[kx][ky], xtile, ytile, 0, 1, 0, 0, 2, 1)
- end
- end
- end
- function TIC()
- cls(0)
- if (btn(0)) then p.y = p.y - 1 end
- if (btn(1)) then p.y = p.y + 1 end
- if (btn(2)) then p.x = p.x - 1 end
- if (btn(3)) then p.x = p.x + 1 end
-
- -- draw tiles
- local xtile = 0
- local ytile = 0
- drawTiles()
- t=t+1
- end
- -- <TILES>
- -- 000:0000006600006666006666666666666600666666000066660000006600000000
- -- 001:6600000066660000666666006666666666666600666600006600000000000000
- -- 002:000000ee0000eeee00eeeeeeeeeeeeee00eeeeee0000eeee000000ee00000000
- -- 003:ee000000eeee0000eeeeee00eeeeeeeeeeeeee00eeee0000ee00000000000000
- -- </TILES>
- -- <SPRITES>
- -- 000:0000000c000000cc000000cc000000cc00000c0c000000cc0000000c0000000c
- -- 001:0000000000000000c0000000ccc00000c00000000000000000000000c0000000
- -- 016:000000cc000000c0000000c0000000c0000000c0000000c00000000000000000
- -- 017:c0000000c0000000c0000000cc0000000c000000000000000000000000000000
- -- </SPRITES>
- -- <PALETTE>
- -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
- -- </PALETTE>
|