The replay object both records and replays game recordings, as well as handle saving and loading replays to and from files. Gameplay recordings are essentially a list of keyboard and mouse inputs, but since Flixel is fairly deterministic, we can use these to play back recordings of gameplay with a decent amount of fidelity.

Constructor

new()

Instantiate a new replay object. Doesn't actually do much until you call create() or load().

Variables

finished:Bool

Whether the replay has finished playing or not.

frame:Int

The current frame for this recording.

frameCount:Int

The number of frames in this recording.

seed:Int

The random number generator seed value for this recording.

Methods

create(Seed:Int):Void

Create a new gameplay recording. Requires the current random number generator seed.

Parameters:

Seed

The current seed from the random number generator.

destroy():Void

Clean up memory.

load(FileContents:String):Void

Load replay data from a String object. Strings can come from embedded assets or external files loaded through the debugger overlay.

Parameters:

FileContents

A String object containing a gameplay recording.

playNextFrame():Void

Get the current frame record data and load it into the input managers.

recordFrame():Void

Get the current input data from the input managers and store it in a new frame record.

rewind():Void

Reset the replay back to the first frame.

save():String

Save the current recording data off to a String object. Basically goes through and calls FrameRecord.save() on each frame in the replay. return The gameplay recording in simple ASCII format.