From 9ba9ec7ae64ed177be9d04293779ca65942fd276 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 24 Apr 2016 21:35:46 -0400 Subject: actor: Add action-effect-lift. * sly/actor.scm (action-effect-lift): New procedure. * doc/api/scripting.texi (Actions): Document it. --- doc/api/scripting.texi | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'doc') 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 -- cgit v1.2.3