require "mapa" batarang = { items = {}, cooldown = 0, dx = 8, draw = function() surf.source(batman.surface) for i, k in pairs(batarang.items) do local flip_h, flip_v = false, false if k.s==1 or k.s==2 then flip_v = true end if k.s==2 or k.s==3 then flip_h = true end draw.surf(123,27,5,5,k.x,k.y,5,5, flip_h, flip_v) end end, update = function() if batarang.cooldown > 0 then batarang.cooldown = batarang.cooldown - 1 end for i, k in pairs(batarang.items) do local tx, ty = ((k.x+2)//8), ((k.y+2)//8) if (mapa.isSolid(tx,ty)) then batarang.items[i] = nil else k.x = k.x + k.dx k.s = k.s + 1 if (k.s==4) then k.s = 0 end end end end, new = function(x,y,flip) --if batarang.cooldown == 0 then table.insert(batarang.items, {x=x, y=y, s=0, dx=flip and -8 or 8}) -- batarang.cooldown = 5 --end end, }