tinyablo.lua 2.0 KB

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