1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function Monster:pos(x, y)
	if not x and not y then
		return self.x, self.y
else
if not occupied(x,y,self.id) then
		 self.x, self.y = x or self.x, y or self.y
end
		for all = 1, 17 do
			if player(all,"exists") and player(all,"health") > 0 then
				if player(all,"x") >= self.x-800 and player(all,"x") <= self.x+800 and player(all,"y") >= self.y-800 and player(all,"y") <= self.y+800 then
imagepos(self.image, self.x, self.y, self.imgang)
imagealpha(self.image, 1)
break
				end
			end
			if all == 17 then
				imagealpha(self.image, 0)
			end
		end
	end
	return true
end