NodeBox

Create visual output with Python programming code
Home Download Reference Tutorial Library Gallery About

boids.Boids.goal()

Syntax

flock.goal(x, y, z)

Description

A flock of boids can have a goal, a point in space it finds interesting and has a tendency to move towards. In the same way, a flock could have mulitple consecutive goals as flagpoles along a flightpath. The nogoal() method removes the current goal.

The x, y and z parameters define the goal's location in space.

Example

Boids flocking around the centre of the canvas:

boids = ximport("boids")
flock = boids.flock(10, 0, 0, WIDTH, HEIGHT)
flock.goal(WIDTH/2, HEIGHT/2, 0)

for i in range(10):
  flock.update()