Move Action

From AgentCubes
Revision as of 22:16, 17 June 2011 by imported>Andri
Jump to navigation Jump to search

150px

Definition: The move action moves an agent one cell in the direction indicated by the Direction parameter. If the dot (.) is selected, the agent will do nothing; it will leave the agent at its current position.
Parameters: direction
Additional Parameters: layer, animation, time: the move action can move an agent in a layer other than the current layer the agent resides on; it can animate the movement with accelerated or constant speed; and it can make the movement happen instantly (if time is 0) or it can take any amount of time to perform the animation. The slider() option in the time parameter connects the animation time to the slider located above the world, next to the other world controls.
Example 1: move on the same layer: In the Frogger game, the Truck agent moves to the right once every half a second, as long as there is road there (second rule in the behavior below). Move action example.png
Example 2: move between layers: In the 3D Matrix game, in its "Lift" method, the Nebuchadnezzar agent moves to the layer above it if the shift and up arrow key are pressed together and if at that position in the layer above, there is a Hole agent (first rule). Similarly, it moves to the layer below it if the shift and down arrow key are pressed together and if at that position in the layer above, there is a Hole agent (second rule). Move action example2.png