- [NEW] animated tiles

This commit is contained in:
2022-10-24 16:34:13 +02:00
parent adc89cf11c
commit 1f002c5488
6 changed files with 88 additions and 80 deletions

View File

@@ -62,21 +62,28 @@ function mapa_save()
io.close(file)
end
anim_tiles={177,178,176}
function mapa_update()
anim_tiles={113,114,112}
function mapa_update(hab1,hab2)
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]
mapa.step=(mapa.step+1)&31
local hab=hab1
repeat
for ty=0,5 do
for tx=0,11 do
local tile=mapa[1+hab][1+tx+ty*12]
if tile>=112 and tile<126 then
mapa[1+hab][1+tx+ty*12]=anim_tiles[tile-111]
end
end
end
end
if hab==hab2 then break end
hab=hab2
until false
end
end
@@ -84,7 +91,7 @@ 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~=256 and (tile<190 or mapa.step~=0) then
if tile~=256 and (tile<126 or mapa.step>4) then
sspr((tile&15)*8,64+(tile>>4)*8,8,8,tx*8,ty*8)
end
end