In order to do something like the demo you would have to capture each input as a frame value and store them in an array.
If you peek at the source code, you'll notice that the
update()
method executes input presses depending on frame values and the camera simply follows and replays its movements.
FRAMES = [0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 2, 2, 2, 2, 10, 10, 10, 10, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8...];
update: function () {
var f = FRAMES[this.frame];
this.frame++;
var left = f & 1, right = f & 2, jump = f & 4, shoot = f & 8;
ig.input.presses['jump'] = jump && !ig.input.actions['jump'];
ig.input.presses['shoot'] = shoot && !ig.input.actions['shoot'];
ig.input.actions['left'] = left;
ig.input.actions['right'] = right;
ig.input.actions['jump'] = jump;
ig.input.actions['shoot'] = shoot;
this.parent();
this.camera.follow(this.player);
}