- WIP animated tiles
This commit is contained in:
25
mapa.lua
25
mapa.lua
@@ -1,6 +1,7 @@
|
||||
--mapa={}
|
||||
tiletype={void=0,stair=1,switch=2,half=3,block=4}
|
||||
|
||||
mapa.wait=0
|
||||
mapa.step=0
|
||||
function mapa_do_backup()
|
||||
mapa_backup={}
|
||||
for i=1,#mapa do
|
||||
@@ -26,7 +27,7 @@ function mapa_new()
|
||||
mapa[mi]={}
|
||||
for ty=0,5 do
|
||||
for tx=0,11 do
|
||||
local tile=255
|
||||
local tile=256
|
||||
if mx==0 and tx==0 then
|
||||
tile=16
|
||||
elseif mx==4 and tx==11 then
|
||||
@@ -61,11 +62,29 @@ function mapa_save()
|
||||
io.close(file)
|
||||
end
|
||||
|
||||
anim_tiles={177,178,176}
|
||||
function mapa_update()
|
||||
mapa.wait=mapa.wait+1
|
||||
|
||||
if mapa.wait==6 then
|
||||
mapa.wait=0
|
||||
mapa.step=(mapa.step+1)&7
|
||||
for ty=0,5 do
|
||||
for tx=0,11 do
|
||||
local tile=mapa[1+hab][1+tx+ty*12]
|
||||
if tile>=176 and tile<190 then
|
||||
mapa[1+hab][1+tx+ty*12]=anim_tiles[tile-175]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mapa_draw(hab)
|
||||
for ty=0,5 do
|
||||
for tx=0,11 do
|
||||
local tile=mapa[1+hab][1+tx+ty*12]
|
||||
if tile~=255 then
|
||||
if tile~=256 and (tile<190 or mapa.step~=0) then
|
||||
sspr((tile&15)*8,64+(tile>>4)*8,8,8,tx*8,ty*8)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user