screenshake.lua 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. -- title: shaker
  2. -- author: pixelbath
  3. -- desc: reference for screenshake effect
  4. shake=0
  5. wobbleDirection = 0
  6. shakeAmount = 0
  7. function wobbleScreen()
  8. shakeAmount=math.max(0,(shakeAmount-0.5))
  9. if shakeAmount>0 then
  10. t=time()/20
  11. offsetX=shakeAmount*math.cos(wobbleDirection)*math.sin(t)
  12. offsetY=shakeAmount*math.sin(wobbleDirection)*math.sin(t)
  13. poke(0x3ff9, offsetX)
  14. poke(0x3ffa, offsetY)
  15. end
  16. end
  17. function TIC()
  18. cls()
  19. map()
  20. print("Press B to shake!", 60, 100)
  21. if btnp(5) then
  22. shakeAmount=shakeAmount+10
  23. wobbleDirection=math.random()*2*math.pi
  24. end
  25. shakeScreen()
  26. end
  27. -- <TILES>
  28. -- 000:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  29. -- 001:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  30. -- 002:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  31. -- 003:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  32. -- 004:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  33. -- 005:a44444aaa4444444a4444444aa444444aa444444a44444444444444444444444
  34. -- 006:aaaaaaaa4aaaaaaa44aaaaaa44aaaaaa44aaaaaa44aaaaaa444aaaaa444aaaa4
  35. -- 007:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa444aaaaa4444aa444444aa
  36. -- 016:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  37. -- 017:aaaaaaaaaaaaaaaaaaaaaaaaccccccccccccccccccccccc2cccccc22ccccc222
  38. -- 018:aaaaaaaaaaaaaaaaaaaaaaaacccccccccccccccc2ccccccc22cccccc222ccccc
  39. -- 019:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  40. -- 020:aaaaaa44aaaaaa44aaaaa444aaaaa444aaa44444aaa44444aaa44444aaa44444
  41. -- 021:44444444444444444444444444444444444444444444a4444aaaaa444aaaaaa4
  42. -- 022:4444a44444444444444444444444444444444444444444444444444444444444
  43. -- 023:4444aaaa4444aaaa4444aaaa4444aaaa4444aaaa44444aaa444444aa444444aa
  44. -- 032:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  45. -- 033:ccccc222cccccc22ccccccc2ccccccccccccccccaaaaaaaaaaaaaaaaaaaaaaaa
  46. -- 034:222ccccc22cccccc2cccccccccccccccccccccccaaaaaaaaaaaaaaaaaaaaaaaa
  47. -- 035:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  48. -- 036:aaa44444aaaaa444aaaaaaaaaaa4444aaaa4444aaaa44444aaa44444aaa44444
  49. -- 037:4aaaaaa44aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4aaaaaaa444aaaaa444aaaaa
  50. -- 038:4444444a444444aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  51. -- 039:aaaa44aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  52. -- 048:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  53. -- 049:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  54. -- 050:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  55. -- 051:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4aaaaaaa4aaaaaaa4
  56. -- 052:aaaa4444aaaa4444aaaa4444aaa44444aaa444444aa444444a44444444444444
  57. -- 053:444aaaaa444aaaaa444aaaaa44aaaaaa44aaaaaa44aaaaaa44aaaaaa4aaaaaaa
  58. -- 054:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  59. -- 055:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  60. -- 064:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  61. -- 065:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  62. -- 066:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  63. -- 067:aaaaaaaaaa444aaaaa44444aaaa44444aaa444a4aaa44444aaa44444aaa44444
  64. -- 068:a4444444a4444444444444444444444444444444444444444444444444444444
  65. -- 069:4aaaaaaa4aaaaaaa4aaaaaaa44aaaaaa444aaaaa444aaaaa444aaaaa444aaaaa
  66. -- 070:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  67. -- 071:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  68. -- 080:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  69. -- 081:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa444
  70. -- 082:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4aa4444a4aa444444aa44444444444444
  71. -- 083:aa444444a4444444a444444444444444444444444444444444444a44aaaaaaaa
  72. -- 084:444444444444444444444444444444444444a444444aaaaa44aaaaaaaaaaaaaa
  73. -- 085:444aaaaa44aaaaaa4aaaaaaa4aaaaaaa4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  74. -- 086:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  75. -- 087:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  76. -- 096:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  77. -- 097:aaaaa444aaaaa444aaaaa444aaaaa444444444aa444444aa4444444444444444
  78. -- 098:4444444444444444444444444a444444aa444444aa444444aa44444aaaaaaaaa
  79. -- 099:aaaaaaaa4aaaaaaa4aaaaaaa4aaaaaaa4aaaaaaa4aaaaaaaaaaaaaaaaaaaaaaa
  80. -- 100:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  81. -- 101:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  82. -- 102:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  83. -- 103:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  84. -- 112:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  85. -- 113:aa444444aa444444aa444444a4444444a444444aa4444aaaa4444aaaaaaaaaaa
  86. -- 114:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  87. -- 115:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  88. -- 116:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  89. -- 117:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  90. -- 118:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  91. -- 119:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  92. -- </TILES>
  93. -- <MAP>
  94. -- 004:000000000000000000000000102030405060700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  95. -- 005:000000000000000000000001112131415161710000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  96. -- 006:000000000000000000000002122232425262720000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  97. -- 007:000000000000000000000003132333435363730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  98. -- 008:000000000000000000000004142434445464740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  99. -- 009:000000000000000000000005152535455565750000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  100. -- 010:000000000000000000000006162636465666760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  101. -- 011:000000000000000000000007172737475767770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  102. -- </MAP>
  103. -- <PALETTE>
  104. -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
  105. -- </PALETTE>