Difference between revisions of "Delayed-Message Action"

From AgentCubes
Jump to navigation Jump to search
imported>Mike
(Created page with "150px {| width="100%" cellspacing="0" cellpadding="10" border="0" |- | width="80" valign="top" align="left" | '''Definition:''' | width="100%" valign=...")
 
imported>Corrina
 
(11 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Image:Move action.png|150px]]  
+
[[Image:Delayed message action.png|200px|Delayed message.png]]  
  
 
{| width="100%" cellspacing="0" cellpadding="10" border="0"
 
{| width="100%" cellspacing="0" cellpadding="10" border="0"
 
|-
 
|-
| width="80" valign="top" align="left" | '''Definition:'''
+
| width="80" valign="top" align="left" | '''Definition:'''  
| width="100%" valign="top" align="left" | The '''delayed-message''' action will trigger a message in this agent after a specified amount of time.
+
| width="100%" valign="top" align="left" | The '''delayed-message''' action: ''will trigger a message in this agent after a specified amount of time. Messages will only be triggered in a running simulation.''&nbsp; <br>
 
|-
 
|-
| width="80" valign="top" align="left" | '''Parameters:'''
+
| width="80" valign="top" align="left" | '''Parameters:'''  
| width="100%" valign="top" align="left" | [[Direction parameter|direction]]
+
| width="100%" valign="top" align="left" |  
 +
[[Method parameter|method]]: ''name of the message''
 +
 
 +
[[Time parameter|time]]: ''how long the delay will last, in seconds.''
 +
 
 
|-
 
|-
| width="80" valign="top" align="left" | '''Example 1:'''
+
| width="80" valign="top" align="left" | '''Example 1:'''  
 
| width="100%" valign="top" align="left" |  
 
| width="100%" valign="top" align="left" |  
'''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).&nbsp;
+
'''Fading shield:'''&nbsp; Imagine you are creating somesort of space based action game where there are obstacles that you must avoid or take damage.&nbsp; In this sort of game you could use the '''delayed message''' action to create a shield which would activae upon a key press condition and which would be set to fade after a certain amount of time with the '''delayed message''' action.&nbsp; In the following image we see a Spaceship agent's behavior.&nbsp; When the user presses the space key and the spaceship is not shielded, it will change to the shielded shape and trigger a delayed message to call "Shields_Fade" in 3 seconds.&nbsp; After three seconds have passed, "Shields_Fade" will be called and the spaceship will change back to its non shielded shape.&nbsp; <br>
  
 +
[[Image:Shields.png]]<br>
  
 +
<br>
  
|-
 
| width="80" valign="top" align="left" | '''Example 2:'''
 
| width="100%" valign="top" align="left" | '''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). [[Image:Move action example2.png|500px|Move action example2.png]]
 
 
|}
 
|}
  
 
[[Category:AgentCubes_Actions]]
 
[[Category:AgentCubes_Actions]]

Latest revision as of 20:36, 20 April 2012

Delayed message.png

Definition: The delayed-message action: will trigger a message in this agent after a specified amount of time. Messages will only be triggered in a running simulation. 
Parameters:

method: name of the message

time: how long the delay will last, in seconds.

Example 1:

Fading shield:  Imagine you are creating somesort of space based action game where there are obstacles that you must avoid or take damage.  In this sort of game you could use the delayed message action to create a shield which would activae upon a key press condition and which would be set to fade after a certain amount of time with the delayed message action.  In the following image we see a Spaceship agent's behavior.  When the user presses the space key and the spaceship is not shielded, it will change to the shielded shape and trigger a delayed message to call "Shields_Fade" in 3 seconds.  After three seconds have passed, "Shields_Fade" will be called and the spaceship will change back to its non shielded shape. 

Shields.png