antmarch.lua 909 B

123456789101112131415161718192021222324252627282930
  1. -- title: antmarch
  2. -- author: _gav, pixelbath
  3. -- desc: _gav found a neat (cheap) way to represent marching ants on an 8x8 tile. can be extended to larger sizes if needed
  4. -- script: lua
  5. local flip_states = {0,1,3,2}
  6. local flip_state = flip_states[math.floor((time() / 333) % 4)+1]
  7. local draw_x = 0
  8. local draw_y = 0
  9. function TIC()
  10. if btnp(0) then draw_y=draw_y-8 end
  11. if btnp(1) then draw_y=draw_y+8 end
  12. if btnp(2) then draw_x=draw_x-8 end
  13. if btnp(3) then draw_x=draw_x+8 end
  14. cls(13)
  15. flip_state = flip_states[math.floor((time() / 333) % 4)+1]
  16. spr(256, draw_x, draw_y, 0, 1, flip_state)
  17. end
  18. -- <SPRITES>
  19. -- 000:cc0ccc0cc000000c0000000cc0000000c000000cc000000c0000000cccc0ccc0
  20. -- 001:000c000cc000000000000000000000000000000cc00000000000000000c000c0
  21. -- </SPRITES>
  22. -- <PALETTE>
  23. -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
  24. -- </PALETTE>