State Driven Agent Sketch

This guide shows how to use the library to create state driven agents. It is based on the 'Cat and Mouse' scenario discussed in the guide on state driven agent design.

The state transition diagram and state descriptions for this scenario can be found in the design document. It is strongly recommended that you look and read these before you continue with these guides.

Source code organisation

In Processing it is possible to split your code over multiple tabs and this is especially useful for larger sketches. In this sketch the code has been split over four tabs

CatAndMouse.pde

This is the main sketch tab contains the code to create the game entities and the core Processing methods such as setup and draw.

Cat.pde

This tab contains the code for the cat and its renderer.

Mouse.pde

This tab contains the code for the mouse and its renderer.

States.pde

The sketch has 7 states and this tab has the source code for them.

 

The remaining guides to this sketch should be read in the order of their links on the right.