NodeBox

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

ants.food()

Syntax

food(x, y, size)

Description

Returns a new food source located at coordinates x and y. The food source yields size units of food and an ant can carry one unit at a time.

Example

ants = ximport("ants")
colony = ants.colony(30, WIDTH/2, HEIGHT/2, 100)

for i in range(8):
  food = ants.food(random(WIDTH), random(HEIGHT), random(40))
  colony.foodsources.append(food)