diff options
author | David Thompson <dthompson2@worcester.edu> | 2016-04-24 21:35:46 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2016-04-24 21:35:46 -0400 |
commit | 9ba9ec7ae64ed177be9d04293779ca65942fd276 (patch) | |
tree | cd3743979314c57b2a0b9bd71f54615403103e58 /doc | |
parent | e362e357faf60f8258ac813f917e08ffd76d5668 (diff) |
actor: Add action-effect-lift.
* sly/actor.scm (action-effect-lift): New procedure.
* doc/api/scripting.texi (Actions): Document it.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/scripting.texi | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/api/scripting.texi b/doc/api/scripting.texi index ca2cfd4..299cf0f 100644 --- a/doc/api/scripting.texi +++ b/doc/api/scripting.texi @@ -221,6 +221,28 @@ transformed. @end deffn +@deffn {Scheme Procedure} action-effect-lift @var{proc} +Create an action constructor from @var{proc}, a procedure of any +number of arguments, whose first two arguments are the world being +transformed and the game object being acted upon. The actions +returned from this new procedure specify that @var{proc} should be +performed as an effect on the world, and do not change the actor +itself. + +@example +;; Theoretical procedure that spawns a new enemy next to the current +;; enemy actor. +(define (spawn-enemy world enemy type) + (add-enemy world (enemy-position enemy) (make-enemy type)) + +(define spawn-enemy* (action-effect-lift spawn-enemy)) + +;; Create a new action that spawns a goblin. +(spawn-enemy* 'goblin) +@end example + +@end deffn + @deffn {Scheme Procedure} both @var{a} @var{b} Peform action @var{a} immediately followed by action @var{b}. When the action is run, the remainder of both @var{a} and @var{b} are |