Scripty Goodness

Platformer now has a simple scripting solution, which will allow me to make cutscenes and do various things when Lenny touches a trigger. The language is sort of like Lisp or Scheme, because that required the least possible amount of effort to code a lexer/parser for. The major problem it solves is the ability to quickly script things that take > 1 frame to execute, e.g., fades, lerps, camera movements, animations, etc. For example, you can execute:

(camera-ease "pointOfInterest" 1)
(fade-out black 0.5)
(camera-cut "somewhereElse")
(fade-in black 0.5)
(camera-ease (get-player) 1)

You don’t have to add in any code to wait until the camera movements or screen fades end; the functions just take however long they take, and the code remains nice and clear and linear.

Stuff that scripts can currently do:

  • Create and destroy entities, as well as show/hide them, and teleport them
  • Move the camera, including cuts, lerps and “ease” motions (which are basically a ‘nonlinear lerp’, if that makes sense, with an ease-in and ease-out to look smooth)
  • Control screen fading

Most of the functions that require a position actually take the name of an entity (or an Entity instance itself), so you can place markers for significant points in the map editor, visually, and then refer to them in scripts.

And now for some screenshots:


PLOT POINT POSSIBLY REVEALED (including crappy Earth)


Sterile corridors?

This is what happens if you run (while true (spawn "player") (wait 0.33))

This is what happens if you run (while true (spawn "player") (wait 0.33))

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>