- [NEW] animated tiles
This commit is contained in:
2
abad.lua
2
abad.lua
@@ -1,5 +1,5 @@
|
||||
|
||||
abad={x=24,y=24,flip=false,frame=1,wait=0,hab=0,vides=3,energia=40,step=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16}}
|
||||
abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,step=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16}}
|
||||
|
||||
function abad_init()
|
||||
abad.update=abad_state_normal
|
||||
|
||||
5
main.lua
5
main.lua
@@ -20,7 +20,7 @@ function _init()
|
||||
table.insert(actors,premiere)
|
||||
z = zombie.new()
|
||||
table.insert(actors,z)
|
||||
c=caco.new(10,24,16)
|
||||
c=caco.new(11,24,16)
|
||||
table.insert(actors,c)
|
||||
score.create()
|
||||
|
||||
@@ -141,7 +141,8 @@ function update_game()
|
||||
prnt("x"..abad.vides,114,13,2)
|
||||
rectfill(102+(abad.energia>>1),30,122,37,16)
|
||||
|
||||
mapa_update()
|
||||
mapa_update(abad.hab,premiere.hab)
|
||||
|
||||
for key,actor in pairs(actors) do
|
||||
actor:update()
|
||||
if actor.hab==cacau.hab and actor~=abad then
|
||||
|
||||
130
map.lua
130
map.lua
@@ -1,20 +1,20 @@
|
||||
mapa={
|
||||
-- 1
|
||||
{
|
||||
18,19,20,21,20,21,20,21,18,19,20,21,
|
||||
16,72,256,256,256,15,256,256,256,17,256,256,
|
||||
16,88,256,256,256,256,256,256,256,17,256,256,
|
||||
16,256,256,256,256,256,256,256,256,38,256,256,
|
||||
16,256,256,256,256,256,256,256,256,38,256,256,
|
||||
20,21,20,21,20,21,20,21,20,21,20,21,
|
||||
256,256,256,18,19,21,20,21,20,21,20,21,
|
||||
64,68,256,16,72,256,256,256,256,256,256,256,
|
||||
256,256,66,256,88,256,256,70,71,256,256,256,
|
||||
256,66,256,16,256,112,256,86,87,256,114,256,
|
||||
66,256,256,16,256,256,256,256,256,256,256,256,
|
||||
256,64,256,16,20,21,20,21,20,21,20,21,
|
||||
|
||||
},
|
||||
-- 2
|
||||
{
|
||||
20,21,20,21,20,21,20,21,20,21,20,21,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,69,256,256,256,69,256,256,256,69,256,
|
||||
256,256,73,74,256,256,256,256,73,74,256,256,
|
||||
256,256,89,90,256,256,256,256,89,90,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
20,21,20,21,20,21,21,256,80,17,20,21,
|
||||
|
||||
@@ -23,30 +23,30 @@ mapa={
|
||||
{
|
||||
20,21,20,21,20,21,20,21,20,21,20,21,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,96,97,96,256,73,74,256,97,96,96,256,
|
||||
256,99,256,100,256,89,90,256,99,256,100,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
20,21,20,21,20,21,20,21,20,21,20,21,
|
||||
|
||||
},
|
||||
-- 4
|
||||
{
|
||||
20,21,20,21,20,21,20,21,20,21,20,21,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
20,21,20,21,20,21,20,21,20,21,18,19,
|
||||
256,256,256,256,256,256,256,256,256,256,77,17,
|
||||
256,73,74,256,256,73,74,256,98,98,93,17,
|
||||
256,89,90,256,256,89,90,256,99,100,256,256,
|
||||
256,256,256,256,256,256,256,256,10,11,256,256,
|
||||
20,21,20,21,20,21,20,21,10,11,20,21,
|
||||
|
||||
},
|
||||
-- 5
|
||||
{
|
||||
20,21,20,21,20,21,20,21,20,21,20,16,
|
||||
256,256,256,256,256,256,256,256,256,256,256,16,
|
||||
256,256,256,256,256,256,256,256,256,256,256,16,
|
||||
256,256,256,256,256,256,256,256,256,256,256,16,
|
||||
256,256,256,256,256,256,256,256,256,256,256,16,
|
||||
20,21,20,21,20,21,20,21,20,21,20,21,
|
||||
66,256,256,67,256,65,256,64,256,256,256,66,
|
||||
256,256,64,256,256,256,256,256,256,68,256,67,
|
||||
18,19,18,19,18,19,18,19,256,256,65,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,16,256,64,256,66,
|
||||
20,21,20,21,20,21,20,21,256,256,66,256,
|
||||
|
||||
},
|
||||
-- 6
|
||||
@@ -101,31 +101,31 @@ mapa={
|
||||
},
|
||||
-- 11
|
||||
{
|
||||
25,29,28,29,28,29,28,29,28,29,28,29,
|
||||
24,256,256,256,256,256,256,256,256,256,256,256,
|
||||
24,256,256,256,256,70,71,256,256,256,256,256,
|
||||
24,256,256,256,69,86,87,69,256,256,256,256,
|
||||
24,256,256,256,256,256,256,256,256,256,256,256,
|
||||
28,29,28,29,28,29,28,29,28,29,28,29,
|
||||
256,66,26,27,28,29,28,29,26,27,28,29,
|
||||
256,256,256,24,256,256,256,256,15,25,256,256,
|
||||
64,68,256,256,256,256,256,256,256,25,256,256,
|
||||
256,256,66,24,256,256,256,256,256,38,256,256,
|
||||
256,66,256,24,101,102,103,256,256,38,256,256,
|
||||
66,256,256,24,28,29,28,29,28,29,28,29,
|
||||
|
||||
},
|
||||
-- 12
|
||||
{
|
||||
28,29,28,29,28,29,29,256,256,256,28,29,
|
||||
256,256,256,256,256,256,256,256,256,25,256,256,
|
||||
256,256,256,256,256,256,256,256,1,256,256,256,
|
||||
256,256,256,256,256,256,256,1,256,256,256,256,
|
||||
28,29,28,29,28,29,29,256,256,256,26,27,
|
||||
256,256,256,256,256,256,256,256,256,25,72,256,
|
||||
256,256,73,74,256,256,256,256,1,256,88,256,
|
||||
256,256,89,90,256,256,256,1,256,256,256,256,
|
||||
256,256,256,256,256,256,1,256,256,256,256,256,
|
||||
28,29,28,29,28,29,28,29,28,29,28,29,
|
||||
|
||||
},
|
||||
-- 13
|
||||
{
|
||||
28,29,28,29,28,29,28,29,28,29,28,29,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
28,29,26,27,26,27,28,29,28,29,28,29,
|
||||
256,256,256,26,27,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,73,74,256,256,
|
||||
256,256,256,98,98,256,256,256,89,90,256,256,
|
||||
256,256,104,101,102,103,256,256,256,256,256,256,
|
||||
28,29,28,29,28,29,29,256,81,25,28,29,
|
||||
|
||||
},
|
||||
@@ -133,20 +133,20 @@ mapa={
|
||||
{
|
||||
28,29,28,29,28,29,28,29,10,11,28,29,
|
||||
256,256,256,256,256,256,256,256,10,11,256,256,
|
||||
256,256,256,256,256,256,256,256,10,11,256,256,
|
||||
256,256,256,256,256,256,256,256,10,11,256,256,
|
||||
256,256,256,256,256,256,256,256,10,11,256,256,
|
||||
256,73,74,256,256,256,256,256,10,11,256,256,
|
||||
256,89,90,256,256,75,76,256,10,11,256,256,
|
||||
256,256,256,256,256,91,92,256,10,11,256,256,
|
||||
28,29,28,29,28,29,28,29,28,29,28,29,
|
||||
|
||||
},
|
||||
-- 15
|
||||
{
|
||||
28,29,28,29,28,29,28,29,28,29,28,24,
|
||||
256,256,256,256,256,256,256,256,256,256,256,24,
|
||||
256,256,256,256,256,256,256,256,256,256,256,24,
|
||||
256,256,256,256,256,256,256,256,256,256,256,24,
|
||||
256,256,256,256,256,256,256,256,256,256,256,24,
|
||||
28,29,28,29,28,29,28,29,28,29,28,29,
|
||||
26,27,26,27,28,29,28,29,26,27,26,27,
|
||||
28,29,256,256,256,256,256,256,256,256,28,24,
|
||||
256,256,256,256,256,73,74,256,256,256,256,24,
|
||||
256,256,75,76,256,89,90,256,75,76,256,24,
|
||||
256,256,91,92,256,256,256,256,91,92,256,24,
|
||||
26,27,28,29,28,29,28,29,28,29,26,27,
|
||||
|
||||
},
|
||||
-- 16
|
||||
@@ -201,51 +201,51 @@ mapa={
|
||||
},
|
||||
-- 21
|
||||
{
|
||||
33,37,36,37,36,37,36,37,36,37,36,37,
|
||||
34,35,36,37,36,37,36,37,36,37,36,37,
|
||||
32,256,256,256,256,256,256,256,256,256,256,256,
|
||||
32,256,256,256,256,256,256,256,256,256,256,256,
|
||||
32,256,256,256,256,256,256,256,256,256,256,256,
|
||||
32,256,8,9,256,256,256,256,256,256,256,256,
|
||||
36,37,8,9,36,37,36,37,36,37,36,37,
|
||||
32,256,97,97,98,256,256,256,97,96,97,256,
|
||||
32,256,99,256,100,256,256,256,99,256,100,256,
|
||||
32,256,8,9,256,104,101,102,103,256,256,256,
|
||||
34,35,8,9,36,37,36,37,36,37,36,37,
|
||||
|
||||
},
|
||||
-- 22
|
||||
{
|
||||
36,37,36,37,36,37,36,37,36,37,36,37,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
36,37,33,33,36,37,36,37,33,33,36,37,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,96,97,96,98,256,256,256,256,
|
||||
256,256,113,256,99,256,256,100,256,114,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
36,37,36,37,36,37,36,37,36,37,36,37,
|
||||
|
||||
},
|
||||
-- 23
|
||||
{
|
||||
36,37,36,37,36,37,37,256,256,256,36,37,
|
||||
37,36,37,36,37,36,37,256,256,256,36,37,
|
||||
256,256,256,256,256,256,256,256,256,33,256,256,
|
||||
256,256,256,256,256,256,256,256,2,256,256,256,
|
||||
256,256,256,256,256,256,256,2,256,256,256,256,
|
||||
256,256,256,256,256,256,2,256,256,256,256,256,
|
||||
256,97,98,97,256,256,112,256,2,256,256,256,
|
||||
256,99,256,100,256,256,256,2,256,75,76,256,
|
||||
256,256,256,256,256,256,2,256,256,91,92,256,
|
||||
36,37,36,37,36,37,36,37,36,37,36,37,
|
||||
|
||||
},
|
||||
-- 24
|
||||
{
|
||||
36,37,36,37,36,37,36,37,36,37,36,37,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
34,35,256,256,256,256,256,256,256,256,34,35,
|
||||
256,2,34,35,34,35,34,35,34,35,2,256,
|
||||
256,256,113,256,256,112,114,256,256,114,256,256,
|
||||
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
256,104,101,102,256,101,102,256,101,102,103,256,
|
||||
36,37,36,37,36,37,36,37,36,37,36,37,
|
||||
|
||||
},
|
||||
-- 25
|
||||
{
|
||||
36,37,36,37,36,37,36,37,36,37,36,33,
|
||||
256,256,256,256,256,256,256,256,256,256,256,32,
|
||||
256,256,256,256,256,256,256,256,256,256,256,32,
|
||||
256,256,256,256,256,256,256,256,256,256,256,32,
|
||||
256,256,256,256,256,256,256,256,8,9,256,32,
|
||||
36,37,36,37,36,37,36,37,36,37,34,35,
|
||||
256,256,256,256,256,256,73,74,256,256,77,32,
|
||||
256,256,96,97,96,256,89,90,256,256,93,32,
|
||||
256,256,99,256,100,256,256,256,256,256,256,32,
|
||||
256,256,256,256,256,101,102,103,8,9,256,32,
|
||||
36,37,36,37,36,37,36,37,8,9,36,37,
|
||||
|
||||
},
|
||||
|
||||
19
mapa.lua
19
mapa.lua
@@ -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
|
||||
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>=176 and tile<190 then
|
||||
mapa[1+hab][1+tx+ty*12]=anim_tiles[tile-175]
|
||||
if tile>=112 and tile<126 then
|
||||
mapa[1+hab][1+tx+ty*12]=anim_tiles[tile-111]
|
||||
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
|
||||
|
||||
@@ -4,8 +4,8 @@ switches={
|
||||
current_list=nil,
|
||||
current_index=-1,
|
||||
}
|
||||
switches[1]={}
|
||||
switches[1][18]={1, 57,45}
|
||||
switches[11]={}
|
||||
switches[11][21]={11, 57,45}
|
||||
|
||||
function switches.start(hab,tile)
|
||||
if switches.cooldown>0 then return end
|
||||
|
||||
Reference in New Issue
Block a user