Browse Source

ants go marching

pixelbath 5 months ago
parent
commit
cf832b6a8c
1 changed files with 30 additions and 0 deletions
  1. 30 0
      awesome/antmarch.lua

+ 30 - 0
awesome/antmarch.lua

@@ -0,0 +1,30 @@
+-- title:   antmarch
+-- author:  _gav, pixelbath
+-- desc:    _gav found a neat (cheap) way to represent marching ants on an 8x8 tile. can be extended to larger sizes if needed
+-- script:  lua
+
+local flip_states = {0,1,3,2}
+local flip_state = flip_states[math.floor((time() / 333) % 4)+1]
+local draw_x = 0
+local draw_y = 0
+function TIC()
+
+	if btnp(0) then draw_y=draw_y-8 end
+	if btnp(1) then draw_y=draw_y+8 end
+	if btnp(2) then draw_x=draw_x-8 end
+	if btnp(3) then draw_x=draw_x+8 end
+
+	cls(13)
+	flip_state = flip_states[math.floor((time() / 333) % 4)+1]
+	spr(256, draw_x, draw_y, 0, 1, flip_state)
+end
+
+-- <SPRITES>
+-- 000:cc0ccc0cc000000c0000000cc0000000c000000cc000000c0000000cccc0ccc0
+-- 001:000c000cc000000000000000000000000000000cc00000000000000000c000c0
+-- </SPRITES>
+
+-- <PALETTE>
+-- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
+-- </PALETTE>
+