function NPC:spawn()
	local ent = {
		x = self.x*16+8,
		y = self.y*16+8,
		mx = 0, my = 0,
		spawn = self,
		type = self.type,
		flagnum = self.flagnum,
		event = self.event,
		flags = self.flags,
		anim = 1,
		life = 0,
		stage = self.stage,
		info = NPC[self.type]
	}
	if ent.info.spawnOffset
		ent.x = ent.x + ent.info.spawnOffset[1]
		ent.y = ent.y + ent.info.spawnOffset[2]
	end
	return setmetatable(ent,{__index=NPC})
end

function NPC:set_anim(anim)
	self.anim = anim
end
