function ia.update_bullet(spr) local tx, ty, ty2 = (spr.pos.x+2)>>3, (spr.pos.y+1)>>3, (spr.pos.y+2)>>3 if rooms.is_outside(tx,ty) then sprites.remove(spr) return end local x1,y1,w1,h1 = util.aabb(spr) for i,v in ipairs(sprites.list) do if v.enemy and v.state ~= templates.DEAD then local x2,y2,w2,h2 = util.aabb(v) if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then if v.state == templates.ALIVE then v.state = templates.DYING end sprites.remove(spr) return end end end if map.tile(tx,ty) < 16 or map.tile(tx,ty2) < 16 then if spr.flipped then spr.pos.x = spr.pos.x - 8 else spr.pos.x = spr.pos.x + 8 end else sprites.remove(spr) end end