Update #30:
I wanted to talk a little bit about how I do cutscenes using the game engine. The cutscenes move the actors around the screen according to a script. It may include dialog, position movements, rotations, following with an offset, most with easing options. Here's a sample of what a piece of one might look like:
I used to use a giant state machine to handle this, which was very difficult to edit. Now I use a helper class with a bunch of coroutines to handle each of the movements, then just put yields in to wait for their completion. Yields basically wait, and resume the code after a certain length of time. Coroutines are like functions, except the calling code does not wait for them to complete before continuing.
This way I can stagger movements in any way I like. I can start a position change on an object that occurs over the course of 2.0 seconds, then wait until 0.5 seconds in to that movement, then start a rotation change on that same object that occurs over 1.0 seconds. The rotation movement will complete before the position movement finishes, because this is all going on at the same time. It makes it really easy to make complex synchronous movements in one big linear script.
The helper class I created to move things around the screen is full of functions that look like this:
It lerps over a period of time. It can ease in, out, or in and out if needed. So you can imagine the helper class has functions for rotations, beziers, fades in and out, music changes. Basically everything that I'm going to be using in cutscenes over and over again (Except for dialog, which is handled in a separate class). For dialog, the main cutscene script can choose to wait until the player has clicked/closed the dialog window before continuing.
The result is a fairly easy to read linear script (sorry for the lack of comments):
You could take this a step further, and make it run off of a text file full of text instructions that the class decodes into actual instructions for the cutscene. Something like that might be useful if you have a non-coder scripting your cutscenes.
@0xlastlifegames