|
@@ -0,0 +1,92 @@
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+t=0
|
|
|
+
|
|
|
+p = {
|
|
|
+ x = 10,
|
|
|
+ y = 10,
|
|
|
+ spr = 0,
|
|
|
+}
|
|
|
+
|
|
|
+skeleton = {
|
|
|
+ spr = 256,
|
|
|
+ x = 3, y = 4,
|
|
|
+}
|
|
|
+
|
|
|
+map = {
|
|
|
+ { 2, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function handle_mouse()
|
|
|
+ mx, my, pl, pm, pr = mouse()
|
|
|
+
|
|
|
+end
|
|
|
+
|
|
|
+function map2screen(mapx, mapy)
|
|
|
+ return (mapx-mapy-1) * 8 - p.x, (mapx+mapy-1) * 4 - p.y
|
|
|
+end
|
|
|
+
|
|
|
+function update()
|
|
|
+ for ky,yt in pairs(map) do
|
|
|
+ for kx,xt in pairs(yt) do
|
|
|
+ xtile, ytile = map2screen(kx, ky)
|
|
|
+ spr(map[kx][ky], xtile, ytile, 0, 1, 0, 0, 2, 1)
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+function TIC()
|
|
|
+ cls(0)
|
|
|
+
|
|
|
+ if (btn(0)) then p.y = p.y - 1 end
|
|
|
+ if (btn(1)) then p.y = p.y + 1 end
|
|
|
+ if (btn(2)) then p.x = p.x - 1 end
|
|
|
+ if (btn(3)) then p.x = p.x + 1 end
|
|
|
+
|
|
|
+
|
|
|
+ local xtile = 0
|
|
|
+ local ytile = 0
|
|
|
+
|
|
|
+ update()
|
|
|
+ t=t+1
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|