summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2016-04-24 21:35:46 -0400
committerDavid Thompson <dthompson2@worcester.edu>2016-04-24 21:35:46 -0400
commit9ba9ec7ae64ed177be9d04293779ca65942fd276 (patch)
treecd3743979314c57b2a0b9bd71f54615403103e58 /doc
parente362e357faf60f8258ac813f917e08ffd76d5668 (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.texi22
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