first commit

This commit is contained in:
2022-10-22 07:53:12 +02:00
commit e1f1e0e95c
10 changed files with 1476 additions and 0 deletions

222
abad.lua Normal file
View File

@@ -0,0 +1,222 @@
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}}
function abad_init()
abad.update=abad_state_normal
end
function abad:draw()
local flip=abad.flip
if abad.update==abad_state_stairs then
flip=(((abad.x>>1)+(abad.y>>1))%2)==0
end
sspr(abad.frame*16,0,16,16,abad.x,abad.y,16,16,flip)
end
function abad_state_normal()
abad.frame=0
abad.wait=0
abad.step=0
abad.jumpfwd=false
if btn(KEY_RIGHT) then
abad.update=abad_state_walking
abad.flip=false
elseif btn(KEY_LEFT) then
abad.update=abad_state_walking
abad.flip=true
elseif btn(KEY_UP) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=false
elseif btn(KEY_DOWN) then
abad.update=abad_state_crouch
elseif btn(KEY_SPACE) and cacau.hab==-1 then
abad.update=abad_state_fire
abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
end
end
function abad_state_crouch()
abad.bb.y=8
abad.bb.h=8
abad.frame=5
abad.wait=0
abad.step=0
abad.jumpfwd=false
if not btn(KEY_DOWN) then
abad.update=abad_state_normal
abad.bb.y=0
abad.bb.h=16
end
end
function abad_state_fire()
abad.frame=6
abad.wait=abad.wait+1
if abad.wait==6 then
abad.wait=0
abad.update=abad_state_normal
end
end
function abad_advance()
local inc=12 if abad.flip then inc=2 end
local limit=tiletype.block
if abad.update~=abad_state_walking then limit=tiletype.half end
if not abad.flip and abad.x==84 then
abad.hab=abad.hab+1
abad.x=-4
elseif check_tile(abad.hab,abad.x+inc,abad.y+14)<limit then
if abad.flip then
abad.x=abad.x-2
else
abad.x=abad.x+2
end
if abad.x<-4 then
abad.hab=abad.hab-1
abad.x=84
end
end
if check_tile(abad.hab,abad.x+6,abad.y+8)==tiletype.stair then
abad.update=abad_state_stairs
elseif abad.update==abad_state_stairs then
abad.update=abad_state_normal
abad.frame=0
end
end
function abad_state_walking()
abad.wait=abad.wait+1
if abad.wait==6 then
abad.wait=0
abad.step=(abad.step+1)%4
abad.frame=abad.anim[abad.step+1]
abad_advance()
if check_tile(abad.hab,abad.x+4,abad.y+16)==tiletype.void and ((abad.x+4)&7==0 or check_tile(abad.hab,abad.x+12,abad.y+16)==tiletype.void) then
abad.update=abad_state_falling
return
end
end
if btn(KEY_UP) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=true
return
elseif btn(KEY_DOWN) then
abad.update=abad_state_crouch
elseif btn(KEY_SPACE) and cacau.hab==-1 then
abad.update=abad_state_fire
abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
end
if btn(KEY_RIGHT) then
abad.flip=false
elseif btn(KEY_LEFT) then
abad.flip=true
elseif abad.wait==0 then
abad.update=abad_state_normal
end
end
function abad_state_jumping()
abad.frame=3
abad.wait=abad.wait+1
print(abad.x,1,50)
print(abad.y,10,50)
if abad.wait==6 then
abad.wait=0
if abad.jumpfwd then abad_advance() end
--local xx=flr((abad.x+4)/8)
--local yy=flr(abad.y/8)
--rect(xx*8,yy*8, (xx+2)*8,(yy+1)*8)
if abad.step<6 then
if abad.y>0 then
if check_tile(abad.hab,abad.x+4,abad.y-2)~=tiletype.block then
if (abad.x+4)&7==0 or check_tile(abad.hab,abad.x+12,abad.y-2)~=tiletype.block then
abad.y=abad.y-2
end
end
else
abad.hab=abad.hab-10
abad.y=32
end
elseif abad.step>6 then
abad.update=abad_state_falling
end
abad.step=abad.step+1
end
end
function abad_state_falling()
abad.frame=3
abad.wait=abad.wait+1
if abad.wait==6 then
abad.wait=0
if abad.jumpfwd then abad_advance() end
local xx=flr((abad.x+4)/8)
local yy=flr((abad.y+16)/8)
if abad.y<32 then
if (abad.y+16)&7==0 and (check_tile(abad.hab,abad.x+4,abad.y+16)>=tiletype.half or ((abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+16)>=tiletype.half)) then
abad.update=abad_state_normal
return
end
abad.y=abad.y+2
else
abad.hab=abad.hab+10
abad.y=0
end
end
end
function abad_state_stairs()
abad.frame=4
abad.wait=abad.wait+1
if abad.wait==6 then
abad.wait=0
if btn(KEY_RIGHT) then
abad.flip=false
abad_advance()
elseif btn(KEY_LEFT) then
abad.flip=true
abad_advance()
elseif btn(KEY_UP) then
if abad.y>0 then
if check_tile(abad.hab,abad.x+4,abad.y+8)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+8)==tiletype.stair then
abad.y=abad.y-2
end
else
abad.hab=abad.hab-10
abad.y=32
end
elseif btn(KEY_DOWN) then
if abad.y<32 then
if check_tile(abad.hab,abad.x+4,abad.y+16)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+16)==tiletype.stair then
abad.y=abad.y+2
end
else
abad.hab=abad.hab+10
abad.y=0
end
end
end
end

41
cacau.lua Normal file
View File

@@ -0,0 +1,41 @@
cacau={hab=-1,x=0,y=0,wait=0,flip=false,bb={x=0,y=0,w=4,h=4}}
function cacau.init(_hab,_x,_y,_flip)
if cacau.hab ~= -1 then return end
cacau.hab=_hab
cacau.x=_x
cacau.y=_y
cacau.flip=_flip
end
function cacau:draw()
circfill(cacau.x,cacau.y,2,16)
circfill(cacau.x,cacau.y,1,6)
end
function cacau:update()
if cacau.hab == -1 then return end
cacau.wait=cacau.wait+1
if cacau.wait==3 then
cacau.wait=0
if cacau.x>96 then
cacau.hab=-1
return
elseif check_tile(cacau.hab,cacau.x,cacau.y)<tiletype.block then
if cacau.flip then
cacau.x=cacau.x-4
else
cacau.x=cacau.x+4
end
if cacau.x<-4 then
cacau.hab=-1
return
end
else
cacau.hab=-1
return
end
end
end

80
caco.lua Normal file
View File

@@ -0,0 +1,80 @@
caco={}
function caco.new(_hab,_x,_y)
return {hab=_hab,x=_x,y=_y,flip=false,frame=0,wait=0,step=0,hit=caco.hit,update=caco.update_normal,draw=caco.draw,jumpfwd=false,anim={19,19,20,21},bb={x=2,y=0,w=12,h=16}}
end
function caco:draw()
sspr((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip)
end
function caco:update_normal()
self.wait=self.wait+1
if self.wait==6 then
self.wait=0
self.step=self.step+1
if self.step<12 then
self.frame=19
elseif self.step==12 then
self.frame=20
elseif self.step==13 then
self.frame=21
self.step=0
end
local inc=14 if self.flip then inc=0 end
if not self.flip and self.x==84 then
self.hab=self.hab+1
self.x=-4
elseif check_tile(self.hab,self.x+inc,self.y+14)<tiletype.block then
if self.flip then
self.x=self.x-2
else
self.x=self.x+2
end
if self.x<-4 then
self.hab=self.hab-1
self.x=84
end
else
self.flip=not self.flip
end
if self.hab==abad.hab then
if aabb(abad,self) then
if abad.energia>0 then abad.energia=abad.energia-1 end
cls(3)
end
end
--if check_tile(self.hab,self.x+4,self.y+16)==tiletype.void and ((self.x+4)&7==0 or check_tile(self.hab,self.x+12,self.y+16)==tiletype.void) then
-- self.flip=not self.flip
--end
end
end
function caco:update_hit()
self.wait=self.wait+1
if self.wait==6 then
self.wait=0
self.step=self.step+1
if self.step<40 then
if self.step%2==0 then
self.frame=21
else
self.frame=7
end
elseif self.step>=40 then
self.frame=19
self.step=0
self.wait=0
self.update=caco.update_normal
end
end
end
function caco:hit()
self.update=caco.update_hit
end

5
game.ini Normal file
View File

@@ -0,0 +1,5 @@
title=Cacaus
width=128
height=96
zoom=4
files=score.lua,map.lua,mapa.lua,cacau.lua,caco.lua,zombie.lua,abad.lua,main.lua

127
main.lua Normal file
View File

@@ -0,0 +1,127 @@
--hab=0
modes={playing=0,editing=1}
mode=modes.editing
seltile = 0
actors={}
function _init()
tiles=loadsurf("tiles.gif")
setsource(tiles)
local pal=loadpal("tiles.gif")
setpal(pal)
--mapa_new()
abad_init()
table.insert(actors,abad)
z = zombie.new()
table.insert(actors,z)
c=caco.new(10,24,16)
table.insert(actors,c)
score.create()
end
function text(str,x,y,col)
color(16)
prnt(str,x-1,y-1)
prnt(str,x,y-1)
prnt(str,x+1,y-1)
prnt(str,x-1,y)
prnt(str,x+1,y)
prnt(str,x-1,y+1)
prnt(str,x,y+1)
prnt(str,x+1,y+1)
prnt(str,x,y,col)
end
function draw_hab(hab,x,y,editing)
camera(-x,-y)
mapa_draw(hab)
if not editing then
for key,actor in pairs(actors) do
if actor.hab==hab then
actor:draw()
end
end
if cacau.hab==hab then cacau:draw() end
end
camera(0,0)
end
function _update()
cls(16)
if mode==modes.editing then
draw_hab(abad.hab,0,0,true)
text(abad.hab,100,10,2)
sspr(0,64,128,48,0,48)
color(3)
local xx=(seltile&15)*8
local yy=48+(seltile>>4)*8
rect(xx,yy,xx+8,yy+8)
text("EDIT",100,1,3)
local hx = abad.hab%10
local hy = flr(abad.hab/10)
if btnp(KEY_RIGHT) and hx<9 then
abad.hab=abad.hab+1
elseif btnp(KEY_LEFT) and hx>0 then
abad.hab=abad.hab-1
elseif btnp(KEY_DOWN) and hy<7 then
abad.hab=abad.hab+10
elseif btnp(KEY_UP) and hy>0 then
abad.hab=abad.hab-10
elseif btnp(KEY_RETURN) then
mode=modes.playing
elseif btnp(KEY_S) then
mapa_save()
elseif btnp(KEY_C) then
mapa_cycle_colors(abad.hab)
end
local mx,my=mousex(),mousey()
if mbtn(1) then
if my>=48 then
seltile=(mx>>3)+((my-48)>>3)*16
elseif mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,seltile)
end
elseif mbtn(3) then
if my<48 and mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,255)
end
end
else
draw_hab(abad.hab,0,0)
text(abad.hab,1,1,2)
draw_hab(10,0,48)
score.draw()
setsource(tiles)
prnt("x"..abad.vides,114,13,2)
rectfill(102+(abad.energia>>1),30,122,37,16)
for key,actor in pairs(actors) do
actor:update()
if actor.hab==cacau.hab and actor~=abad then
if aabb(actor,cacau) then
actor:hit()
cacau.hab=-1
end
end
end
cacau.update()
if btnp(KEY_RETURN) then
mode=modes.editing
end
end
end
function aabb(a, b)
return (a.x+a.bb.x+a.bb.w >= b.x+b.bb.x) and (a.x+a.bb.x <= b.x+b.bb.x+b.bb.w) and (a.y+a.bb.y+a.bb.h >= b.y+b.bb.y) and (a.y+a.bb.y <= b.y+b.bb.y+b.bb.h)
end

802
map.lua Normal file
View File

@@ -0,0 +1,802 @@
mapa={
-- 1
{
18,19,20,21,20,21,20,21,20,21,20,21,
16,72,255,255,255,255,255,255,255,255,255,255,
16,88,255,255,255,255,255,255,255,255,255,255,
16,255,255,255,255,255,255,255,255,255,255,255,
16,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 2
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,69,255,255,255,69,255,255,255,69,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,21,255,255,17,20,21,
},
-- 3
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
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,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,10,11,255,255,
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,
255,255,255,255,255,255,255,255,255,255,255,16,
255,255,255,255,255,255,255,255,255,255,255,16,
255,255,255,255,255,255,255,255,255,255,255,16,
255,255,255,255,255,255,255,255,255,255,255,16,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 6
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 7
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 8
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 9
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 10
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 11
{
25,29,28,29,28,29,28,29,28,29,28,29,
24,255,255,255,255,255,255,255,255,255,255,255,
24,255,255,255,255,70,71,255,255,255,255,255,
24,255,255,255,69,86,87,69,255,255,255,255,
24,255,255,255,255,255,255,255,255,255,255,255,
28,29,28,29,28,29,28,29,28,29,28,29,
},
-- 12
{
28,29,28,29,28,29,29,255,255,255,28,29,
255,255,255,255,255,255,255,255,255,25,255,255,
255,255,255,255,255,255,255,255,1,255,255,255,
255,255,255,255,255,255,255,1,255,255,255,255,
255,255,255,255,255,255,1,255,255,255,255,255,
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,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
28,29,28,29,28,29,29,255,255,25,28,29,
},
-- 14
{
28,29,28,29,28,29,28,29,10,11,28,29,
255,255,255,255,255,255,255,255,10,11,255,255,
255,255,255,255,255,255,255,255,10,11,255,255,
255,255,255,255,255,255,255,255,10,11,255,255,
255,255,255,255,255,255,255,255,10,11,255,255,
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,
255,255,255,255,255,255,255,255,255,255,255,24,
255,255,255,255,255,255,255,255,255,255,255,24,
255,255,255,255,255,255,255,255,255,255,255,24,
255,255,255,255,255,255,255,255,255,255,255,24,
28,29,28,29,28,29,28,29,28,29,28,29,
},
-- 16
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 17
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 18
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 19
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 20
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 21
{
33,37,36,37,36,37,36,37,36,37,36,37,
32,255,255,255,255,255,255,255,255,255,255,255,
32,255,255,255,255,255,255,255,255,255,255,255,
32,255,255,255,255,255,255,255,255,255,255,255,
32,255,8,9,255,255,255,255,255,255,255,255,
36,37,8,9,36,37,36,37,36,37,36,37,
},
-- 22
{
36,37,36,37,36,37,36,37,36,37,36,37,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
36,37,36,37,36,37,36,37,36,37,36,37,
},
-- 23
{
36,37,36,37,36,37,37,255,255,255,36,37,
255,255,255,255,255,255,255,255,255,33,255,255,
255,255,255,255,255,255,255,255,2,255,255,255,
255,255,255,255,255,255,255,2,255,255,255,255,
255,255,255,255,255,255,2,255,255,255,255,255,
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,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
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,
255,255,255,255,255,255,255,255,255,255,255,32,
255,255,255,255,255,255,255,255,255,255,255,32,
255,255,255,255,255,255,255,255,255,255,255,32,
255,255,255,255,255,255,255,255,8,9,255,32,
36,37,36,37,36,37,36,37,8,9,36,37,
},
-- 26
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 27
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 28
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 29
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 30
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 31
{
41,45,8,9,44,45,44,45,44,45,44,45,
40,255,8,9,255,255,255,255,255,255,255,255,
40,255,8,9,255,255,255,255,255,255,255,255,
40,255,8,9,255,255,255,255,255,255,255,255,
40,255,8,9,255,255,255,255,255,255,255,255,
44,45,8,9,44,45,44,45,44,45,44,45,
},
-- 32
{
44,45,44,45,44,45,44,45,44,45,44,45,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
44,45,44,45,44,45,45,255,255,41,44,45,
},
-- 33
{
44,45,44,45,44,45,44,45,44,45,44,45,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
44,45,44,45,44,45,44,45,44,45,44,45,
},
-- 34
{
44,45,44,45,44,45,44,45,44,45,44,41,
255,255,255,255,255,255,255,255,255,255,255,40,
255,255,255,255,255,255,255,255,255,255,255,40,
255,255,255,255,255,255,255,255,255,255,255,40,
255,255,255,255,255,255,255,255,255,255,255,40,
44,45,41,255,255,44,44,45,44,45,44,45,
},
-- 35
{
25,29,28,29,28,29,28,29,8,9,28,25,
24,255,255,255,255,255,255,255,8,9,255,24,
24,255,255,255,255,255,255,255,8,9,255,24,
24,255,255,255,255,255,255,255,8,9,255,24,
24,255,255,255,255,255,255,255,8,9,255,24,
28,29,28,29,28,29,28,29,8,9,28,29,
},
-- 36
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 37
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 38
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 39
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 40
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 41
{
25,29,8,9,28,29,28,29,28,29,28,29,
24,255,8,9,255,255,255,255,255,255,255,255,
24,255,8,9,255,255,255,255,255,255,255,255,
24,255,8,9,255,255,255,255,255,255,255,255,
24,255,8,9,255,255,255,255,255,255,255,255,
28,29,28,29,28,29,29,255,255,25,28,29,
},
-- 42
{
28,29,28,29,28,29,29,255,255,255,28,29,
255,255,255,255,255,255,255,255,255,25,255,255,
255,255,255,255,255,255,255,255,1,255,255,255,
255,255,255,255,255,255,255,1,255,255,255,255,
255,255,255,255,255,255,1,255,255,255,255,255,
28,29,28,29,28,29,28,29,28,29,28,29,
},
-- 43
{
28,29,28,29,28,29,28,29,28,29,28,25,
255,255,255,255,255,255,255,255,255,255,255,24,
255,255,255,255,255,255,255,255,255,255,255,24,
255,255,255,255,255,255,255,255,255,255,255,24,
255,255,10,11,255,255,255,255,255,255,255,24,
28,29,10,11,28,29,28,29,28,29,28,29,
},
-- 44
{
33,37,255,255,255,36,36,37,36,37,36,37,
32,255,33,255,255,255,255,255,255,255,255,255,
32,255,255,2,255,255,255,255,255,255,255,255,
32,255,255,255,2,255,255,255,255,255,255,255,
32,255,255,255,255,2,255,255,255,255,255,255,
36,37,36,37,36,37,36,37,36,37,36,37,
},
-- 45
{
36,37,36,37,36,37,36,37,8,9,36,33,
255,255,255,255,255,255,255,255,8,9,255,32,
255,255,255,255,255,255,255,255,8,9,255,32,
255,255,255,255,255,255,255,255,8,9,255,32,
255,255,255,255,255,255,255,255,8,9,255,32,
36,37,36,37,36,37,36,37,36,37,36,37,
},
-- 46
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 47
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 48
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 49
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 50
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 51
{
41,45,44,45,44,45,45,255,255,255,44,45,
40,255,255,255,255,255,255,255,255,41,255,255,
40,255,255,255,255,255,255,255,3,255,255,255,
40,255,255,255,255,255,255,3,255,255,255,255,
40,255,255,255,255,255,3,255,255,255,255,255,
44,45,44,45,44,45,44,45,44,45,44,45,
},
-- 52
{
44,45,44,45,44,45,44,45,44,45,44,41,
255,255,255,255,255,255,255,255,255,255,255,40,
255,255,255,255,255,255,255,255,255,255,255,40,
255,255,255,255,255,255,255,255,255,255,255,40,
255,255,255,255,255,255,255,255,255,255,255,40,
44,45,41,255,255,44,44,45,44,45,44,45,
},
-- 53
{
17,21,10,11,20,21,20,21,20,21,20,21,
16,255,10,11,255,255,255,255,255,255,255,255,
16,255,10,11,255,255,255,255,255,255,255,255,
16,255,10,11,255,255,255,255,255,255,255,255,
16,255,10,11,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 54
{
20,21,20,21,20,21,18,19,67,255,255,255,
255,255,255,255,255,255,18,19,255,65,68,64,
255,255,255,255,255,255,18,19,255,255,255,255,
255,255,255,255,255,255,255,255,67,255,64,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,54,55,54,56,
},
-- 55
{
255,65,255,255,255,67,255,67,255,255,255,255,
255,255,255,64,255,255,255,255,65,68,64,255,
255,255,255,255,255,255,64,255,255,255,255,67,
255,255,65,67,255,255,64,255,255,64,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
54,55,54,56,56,55,54,56,54,56,55,54,
},
-- 56
{
65,255,255,255,67,255,67,255,255,255,255,64,
255,255,64,255,255,255,255,65,68,64,255,255,
255,255,255,255,255,64,255,255,255,255,67,255,
255,65,67,255,255,64,255,255,64,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
55,54,55,54,56,54,55,56,54,55,54,56,
},
-- 57
{
255,255,255,67,34,35,34,35,34,35,34,35,
255,64,255,255,34,35,255,255,255,255,255,255,
255,255,255,255,34,35,255,255,255,255,255,255,
65,67,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
54,55,56,54,36,37,36,37,36,37,36,37,
},
-- 58
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 59
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 60
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 61
{
17,21,20,21,20,21,20,21,20,21,20,21,
16,255,255,255,255,255,255,255,255,255,255,255,
16,255,255,255,255,255,255,255,255,255,255,255,
16,255,255,255,255,255,255,255,255,255,255,255,
16,255,10,11,255,255,255,255,255,255,255,255,
20,21,10,11,20,21,20,21,20,21,20,21,
},
-- 62
{
20,21,255,255,255,20,20,21,20,21,20,21,
255,255,17,255,255,255,255,255,255,255,255,255,
255,255,255,0,255,255,255,255,255,255,255,255,
255,255,255,255,0,255,255,255,255,255,255,255,
255,255,255,255,255,0,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 63
{
20,21,20,21,20,21,20,21,20,21,20,17,
255,255,255,255,255,255,255,255,255,255,255,16,
255,255,255,255,255,255,255,255,255,255,255,16,
255,255,255,255,255,255,255,255,255,255,255,16,
255,255,255,255,255,255,255,255,255,255,255,16,
20,21,17,255,255,20,20,21,20,21,20,21,
},
-- 64
{
41,48,49,48,50,49,48,49,48,50,49,48,
41,255,255,255,255,255,255,255,255,255,255,255,
41,255,255,255,255,255,255,255,255,255,255,255,
41,255,255,255,255,255,255,255,255,255,255,255,
41,255,8,9,255,255,255,255,255,255,255,255,
42,43,8,9,42,43,42,43,42,43,42,43,
},
-- 65
{
48,50,48,49,50,49,50,48,50,49,50,48,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,42,43,42,43,
255,255,255,255,42,43,42,43,255,255,255,255,
42,43,42,43,255,255,255,255,255,255,255,255,
},
-- 66
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 67
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 68
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 69
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 70
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 71
{
26,27,10,11,26,27,26,27,26,27,26,27,
25,255,10,11,255,255,255,255,255,255,255,255,
25,255,10,11,255,255,255,255,255,255,255,255,
25,255,10,11,255,255,255,255,255,255,255,255,
25,255,10,11,255,255,255,255,255,255,255,255,
26,27,26,27,26,27,26,27,26,27,26,27,
},
-- 72
{
26,27,26,27,26,27,26,27,26,27,26,27,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
26,27,26,27,26,27,26,27,26,27,26,27,
},
-- 73
{
26,27,255,255,255,25,26,27,26,27,26,27,
255,255,25,255,255,255,255,255,255,255,255,255,
255,255,255,1,255,255,255,255,255,255,255,255,
255,255,255,255,1,255,255,255,255,255,255,255,
255,255,255,255,255,1,255,255,255,255,255,255,
26,27,26,27,26,27,26,27,26,27,26,27,
},
-- 74
{
26,27,8,9,26,27,26,27,26,27,26,27,
255,255,8,9,255,255,255,255,255,255,255,255,
255,255,8,9,255,255,255,255,255,255,255,255,
255,255,8,9,255,255,255,255,255,255,255,255,
255,255,8,9,255,255,255,255,255,255,255,255,
26,27,26,27,26,27,26,27,26,27,26,27,
},
-- 75
{
26,27,26,27,26,27,26,27,26,27,26,27,
255,255,255,255,255,255,255,255,255,255,26,27,
255,255,255,255,255,255,255,255,255,255,26,27,
255,255,255,255,255,255,255,255,255,255,26,27,
255,255,255,255,255,255,255,255,255,255,26,27,
26,27,26,27,26,27,26,27,26,27,26,27,
},
-- 76
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 77
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 78
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 79
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 80
{
20,21,20,21,20,21,20,21,20,21,20,21,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,
20,21,20,21,20,21,20,21,20,21,20,21,
},
}

93
mapa.lua Normal file
View File

@@ -0,0 +1,93 @@
--mapa={}
tiletype={void=0,stair=1,half=2,block=3}
function mapa_new()
for my=0,7 do
for mx=0,9 do
local mi=1+mx+my*10
mapa[mi]={}
for ty=0,5 do
for tx=0,11 do
local tile=255
if mx==0 and tx==0 then
tile=16
elseif mx==4 and tx==11 then
tile=16
elseif ty==0 or ty==5 then
if tx%2==0 then
tile=20
else
tile=21
end
end
mapa[mi][1+tx+ty*12]=tile
end
end
end
end
end
function mapa_save()
file = io.open("data/map.lua", "w")
io.output(file)
io.write("mapa={\n")
for i=1,80 do
io.write(" -- "..i.."\n {\n ")
for j=1,72 do
io.write(mapa[i][j]..",")
if j%12==0 then io.write("\n ") end
end
io.write("\n },\n")
end
io.write("}\n")
io.close(file)
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
sspr((tile&15)*8,64+(tile>>4)*8,8,8,tx*8,ty*8)
end
end
end
end
function mapa_set_tile(hab,x,y,tile)
mapa[1+hab][1+x+y*12]=tile
end
function mapa_get_tile(hab,x,y)
return mapa[1+hab][1+x+y*12]
end
function mapa_cycle_colors(hab)
for i=1,72 do
local tile=mapa[1+hab][i]
if tile<4 then
tile=(tile+1)&3
elseif tile>=16 and tile<48 then
tile=tile+8
if tile>=48 then tile=tile-32 end
end
mapa[1+hab][i]=tile
end
end
function check_tile(hab,x,y)
local xx=min(11,max(0,flr(x/8)))
local yy=min(5,max(0,flr(y/8)))
--rect(xx*8,yy*8,xx*8+8,yy*8+8,3)
local tile=mapa_get_tile(hab,xx,yy)
if tile<8 then
return tiletype.half
elseif tile<16 then
return tiletype.stair
elseif tile<64 then
return tiletype.block
else
return tiletype.void
end
end

34
score.lua Normal file
View File

@@ -0,0 +1,34 @@
score={}
function score.create()
score.surf=newsurf(32,96)
setdest(score.surf)
cls(16)
sspr(0,0,16,9,5,9,16,9,true)
spr(132,0,0,1,1) spr(150,8,0,1,1) spr(150,16,0,1,1) spr(133,24,0,1,1)
spr(134,0,8,1,1) spr(135,24,8,1,1) spr(134,0,16,1,1) spr(135,24,16,1,1)
spr(132,0,24,1,1) spr(150,8,24,1,1) spr(150,16,24,1,1) spr(133,24,24,1,1)
spr(134,0,32,1,1) spr(135,24,32,1,1)
spr(132,0,40,1,1) spr(150,8,40,1,1) spr(150,16,40,1,1) spr(133,24,40,1,1)
spr(134,0,48,1,1) spr(135,24,48,1,1) spr(134,0,56,1,1) spr(135,24,56,1,1)
spr(134,0,64,1,1) spr(135,24,64,1,1) --spr(134,0,72,1,1) spr(135,24,72,1,1)
spr(132,0,72,1,1) spr(150,8,72,1,1) spr(150,16,72,1,1) spr(133,24,72,1,1)
spr(134,0,80,1,1) spr(135,24,80,1,1) spr(134,0,88,1,1) spr(135,24,88,1,1)
prnt("jail",6,77,2)
prnt("games",8,82,2)
prnt("2022",9,89,1)
rectfill(06,30,07,37,03)
rectfill(09,30,10,37,08)
rectfill(12,30,13,37,08)
rectfill(15,30,16,37,10)
rectfill(18,30,19,37,10)
rectfill(21,30,22,37,10)
rectfill(24,30,25,37,10)
setdest(0)
end
function score.draw()
setsource(score.surf)
sspr(0,0,32,96,96,0)
end

BIN
tiles.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

72
zombie.lua Normal file
View File

@@ -0,0 +1,72 @@
zombie={}
function zombie:new()
return {hab=2,x=24,y=24,flip=false,frame=0,wait=0,step=0,hit=zombie.hit,update=zombie.update_normal, draw=zombie.draw,jumpfwd=false,anim={16,17,16,18},bb={x=4,y=0,w=8,h=16}}
end
function zombie:draw()
sspr((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip)
end
function zombie:update_normal()
self.wait=self.wait+1
if self.wait==6 then
self.wait=0
self.step=(self.step+1)%4
self.frame=self.anim[self.step+1]
local inc=12 if self.flip then inc=2 end
if not self.flip and self.x==84 then
self.hab=self.hab+1
self.x=-4
elseif check_tile(self.hab,self.x+inc,self.y+14)<tiletype.block and check_tile(self.hab,self.x+inc,self.y+16)~=tiletype.void then
if self.flip then
self.x=self.x-2
else
self.x=self.x+2
end
if self.x<-4 then
self.hab=self.hab-1
self.x=84
end
else
self.flip=not self.flip
end
if self.hab==abad.hab then
if aabb(abad,self) then
if abad.energia>0 then abad.energia=abad.energia-1 end
cls(3)
end
end
--if check_tile(self.hab,self.x+4,self.y+16)==tiletype.void and ((self.x+4)&7==0 or check_tile(self.hab,self.x+12,self.y+16)==tiletype.void) then
-- self.flip=not self.flip
--end
end
end
function zombie:update_hit()
self.wait=self.wait+1
if self.wait==6 then
self.wait=0
self.step=self.step+1
if self.step<40 then
if self.step%2==0 then
self.frame=16
else
self.frame=7
end
elseif self.step>=40 then
self.step=0
self.wait=0
self.update=zombie.update_normal
end
end
end
function zombie:hit()
self.update=zombie.update_hit
end