Message-In-Stack Action

From AgentCubes
Revision as of 21:30, 5 April 2012 by imported>Mike
Jump to navigation Jump to search

150px 150px

Definition: The message in stack action will trigger a message in other agents in this agent's stack.  Note that this agent will not receive the message from message in stack.
Parameters: method, agents_in_stack: The method parameter specifies which method needs to be called.  The agents_in_stack parameter specifies which other agents in this agent's stack should receive the spcified message. 
Example:

Composite Agents: Image you wanted to create a tank that was a combination of a base agent for the wheels of the tank and a turret agent which would go on top.  When moving the tank we could have the movement be syncrhonzied by using the transport action but in order to cause the turret to rotate with the base of the tank we could use the Message In Stack.  In the following image we see the behavior of a tank agent which represent the base of the tank.  When the left key is pressed before rotating itself, it send a rotate_turret_left message to itself.  The method rotate_turret_left checks to make sure it stacked immediatley below a turret and if so it messages the agent immediatley above it with a rotate_left message (this method will also perform a -90 degree rotattion).  

Tank.png