Behavior editor

The Following Example, taken from the Frogger_Tutorial, gives you an introduction into editing Agent Behaviors in AgentSheets



Use the "Edit Behavior" button to open the Frog behavior editor: In the Gallery window select the Frog agent and click the "Edit Behavior" button located at the bottom of the Gallery window; This should bring up the Behavior Editor for the Frog, which at this point will contain no behaviors.

The kind of behaviors that we will give to our Agents are called rules. Rules are made up of an IF-THEN statement. For controlling the Frog using the cursor keys, one of the rules we need should be that “IF the Up key is hit, THEN the frog will move up.” Overall we should have 4 rules, one for each direction (Up, Down, Left, Right).

Double click the “If” box to get the Conditions Palette. Alternatively, go to Tools->Conditions Palette. This will open the Conditions window that contains all the available conditions (blue language pieces).

Double click on the “Then” box to get the Actions Palette. Alternatively, go to Tools->Actions Palette. This will open the Actions window that contains all the available actions (red language pieces).

Add the "Key" condition to the Frog's behavior: Click on the “Key” label of the Key condition in the Conditions Palette and drag it into the “If” part of the rule in the Behavior Editor. Click on the letter within in the Key condition (the default is 'A') and it when it says “Press Any Key”, hit the "Up" arrow on the keyboard. If the up Arrow is pressed, then we want the Frog to move up one space.

Add the "Move" action to the Frog's behavior: Drag the “Move” action from the Actions Palette to the “Then” part of the rule in the Behavior Editor. Click the arrow in the “Move” command box and change the direction to "Up". When you’re all done the Behavior Editor for the Frog should look like the following: Click the “Apply” Button located at the bottom right of the Behavior Editor to make these changes take effect for the Frog agent.