tinyablo.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. -- title: isoshit
  2. -- author: pixelbath
  3. -- desc: isometric stuff
  4. -- script: lua
  5. -- references: The Immortal (NES), Solstice (NES)
  6. t=0
  7. p = {
  8. x = -140,
  9. y = -20,
  10. spr = 0,
  11. }
  12. skeleton = {
  13. spr = 256,
  14. x = 3, y = 4,
  15. }
  16. map = {
  17. { 2, 0, 0, 0, 0, 0, 0, 0 },
  18. { 0, 0, 0, 0, 0, 0, 0, 0 },
  19. { 0, 0, 0, 2, 0, 0, 0, 0 },
  20. { 0, 0, 0, 0, 2, 0, 0, 0 },
  21. { 0, 0, 0, 0, 0, 2, 0, 0 },
  22. { 0, 0, 0, 0, 0, 0, 0, 0 },
  23. { 0, 0, 0, 0, 0, 0, 0, 0 },
  24. { 0, 0, 0, 0, 0, 0, 0, 0 },
  25. }
  26. function handle_mouse()
  27. local mx, my, pl, pm, pr = mouse()
  28. end
  29. function map2screen(mapx, mapy)
  30. return (mapx-mapy-1) * 8 - p.x, (mapx+mapy-1) * 4 - p.y
  31. end
  32. function drawTiles()
  33. for ky,yt in pairs(map) do
  34. for kx,xt in pairs(yt) do
  35. xtile, ytile = map2screen(kx, ky)
  36. spr(map[kx][ky], xtile, ytile, 0, 1, 0, 0, 2, 1)
  37. end
  38. end
  39. end
  40. function TIC()
  41. cls(0)
  42. if (btn(0)) then p.y = p.y - 1 end
  43. if (btn(1)) then p.y = p.y + 1 end
  44. if (btn(2)) then p.x = p.x - 1 end
  45. if (btn(3)) then p.x = p.x + 1 end
  46. -- draw tiles
  47. local xtile = 0
  48. local ytile = 0
  49. drawTiles()
  50. t=t+1
  51. end
  52. -- <TILES>
  53. -- 000:0000006600006666006666666666666600666666000066660000006600000000
  54. -- 001:6600000066660000666666006666666666666600666600006600000000000000
  55. -- 002:000000ee0000eeee00eeeeeeeeeeeeee00eeeeee0000eeee000000ee00000000
  56. -- 003:ee000000eeee0000eeeeee00eeeeeeeeeeeeee00eeee0000ee00000000000000
  57. -- </TILES>
  58. -- <SPRITES>
  59. -- 000:0000000c000000cc000000cc000000cc00000c0c000000cc0000000c0000000c
  60. -- 001:0000000000000000c0000000ccc00000c00000000000000000000000c0000000
  61. -- 016:000000cc000000c0000000c0000000c0000000c0000000c00000000000000000
  62. -- 017:c0000000c0000000c0000000cc0000000c000000000000000000000000000000
  63. -- </SPRITES>
  64. -- <PALETTE>
  65. -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
  66. -- </PALETTE>