Delayed-Message Action

From AgentCubes
Jump to navigation Jump to search

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. 

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.