local arcade_config = require("arcade_config") o2aX = arcade_config.org2arc_escala cxr = arcade_config.character_per_row-1 cxr2 = arcade_config.character_per_row_base2 cw = arcade_config.character_width ch = arcade_config.character_height zombie={} function zombie.new(_hab,_x,_y,_flip) return {hab=_hab,x=_x,y=_y,flip=_flip,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() -- if self.frame>0 then draw.surf((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip) end if self.frame>0 then draw.surf((self.frame&7)*cw,(self.frame>>cxr2)*ch,cw,ch,self.x*o2aX,self.y*o2aX,cw,ch,self.flip) end 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)=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