def walk(self):
		"""Randomly move up, down, left, right or stay in one place."""
		# NOTE: pyprocessing perlin noise functionality appears to be glitchy
		# (it freezes at exactly 0 for a series of steps)
		self.location[0] = p.map(p.noise(self.noff[0]), -1, 1, 0, width)
		self.location[1] = p.map(p.noise(self.noff[1]), -1, 1, 0, height)
		self.noff += 0.01
Exemplo n.º 2
0
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.n = random.randint(3, 30)
        self.radius = random.randint(10, 100)
        self.size = random.randint(3, 15)
        self.colour = random.choice(COLOURS)

        self.angle = random.random() * 2 * math.pi
        self.speed = p.map(self.radius, 10, 100, 0.03, 0.01)

        # randomise direction of rotation
        if random.random() > 0.5:
            self.speed *= -1