def update(self):
	
		self.steering = self.mintrunc(self.steering + self.avoidance, MAXFOR)
		self.steering = self.steering / self.mass
		self.velocity = self.maxtrunc(self.velocity + self.steering, MAXSPD)
		
		self.position = self.position + self.velocity
	
		if(self.position.x < 0):self.position.x = kd.sp['width']
		if(self.position.x > kd.sp['width']):self.position.x = 0
		if(self.position.y < 0):self.position.y = kd.sp['height'] 
		if(self.position.y > kd.sp['height']):self.position.y = 0
		
		PKFW.spmo(self.sprite,self.position.x, self.position.y)
	def LevelGridDraw(self):
		for x in range(len(self.levelTiles)):
			for y in range(len(self.levelTiles[x])):
				if(self.levelTiles[x][y].Sid != -1):
					PKFW.spmo(self.levelTiles[x][y].Sid,self.levelTiles[x][y].pos.x, self.levelTiles[x][y].pos.y )
					PKFW.spdr(self.levelTiles[x][y].Sid)	
		
		for i in range(len(self.wanderers)):
			self.wanderers[i].obstacleAvoid(walls)
			self.wanderers[i].update()
			self.wanderers[i].draw()
			if(math.isnan(self.wanderers[i].position.x) or math.isnan(self.wanderers[i].position.y)):
				# on rare occasions the boid position and steering becomes NAN due to being too close to too many 
				# walls... I am not sure why this is happening and have implemented a half fix which just
				# re initialises the boid if this happens
				self.wanderers[i] = ai.boid(kd.sp['width']*0.5, kd.sp['height']*0.5, 64, sprites[5])
		
		if(self.flock is not None):
			self.flock.update()