draw the map (make the map rount you are visble)
local radius = 500;
game.player.force.chart(game.player.surface, {
{game.player.position.x - radius, game.player.position.y - radius},
{game.player.position.x + radius, game.player.position.y + radius}
})
Destory the enemies nearby player
function ()
local radius = 250
local surface=game.player.surface
local pp = game.player.position
local cnt = 0
for key, entity in pairs(surface.find_entities_filtered({force="enemy"})) do
if entity.position.x > pp.x - radius
and entity.position.x < pp.x + radius
and entity.position.y > pp.y - radius
and entity.position.y < pp.y + radius
then
cnt = cnt+1 entity.destroy()
end
end
game.player.print(cnt)
end