If Then Statements

From Scalable Game Design wiki
Jump to navigation Jump to search

Examples of If-Then conditionality statements exist in our every day life. For example, “If I miss the bus, Then I will Walk” or “If the teacher calls on me, Then I will answer the question.” Similarly to these statements-- If Then conditionality statements are the main way we add behaviors to Agents in AgentSheets through the [[Behavior_editor|Behavior Editor). For example, let's say we wanted to control an agent through keyboard strokes in AgentSheets. This can be achieved through If-Then directional statements --“If the Up key is hit on the keyboard, Then the agent will move up.” Overall we should have 4 “If-Then” statements, one for each direction (Up, Down, Left, Right) if we want the agent to move all four directions. The following depicts the behaviors one would add to a given agent to achieve this.

directional behaviors