Changing the Speed of an Agent

How do I make an agent go faster or slower?


An agent can be asked to take multiple steps at a time and so move at different speeds. By having an agent keep track of its speed with a variable, you can adjust its speed based on its current speed.

In this code, the agent accelerates when the up arrow key is pressed and decelerates when the down arrow or space bar is pressed.

Submitted by talaya on 20. February 2008 - 18:03