Replay not playing.



  • How to get the replay, the recorded movements to play. the code below records and then saves the recorded movements to file but does not play.

    	private static var recording:Bool = false;
    	private static var replaying:Bool = false;
    
    if (FlxG.keys.anyPressed(["R"]) && recording) FlxG.vcr.stopRecording(true);
    if (FlxG.keys.anyPressed(["S"]) && !recording && !replaying) {recording = true; replaying = false; FlxG.vcr.startRecording(true); };
    if (FlxG.keys.anyPressed(["L"])) {replaying = false; FlxG.vcr.loadReplay("assets/data/replay.fgr", new PlayState());}
    

    without any key input, i also tried recording with a reg int that included in value when the program started so that it fired only once and saving to file when an object was collected. nothing happened.

    An open source retro style platform game made using Haxeflixel https://www.thespacecastle.org/

    0

  • administrators

    loadReplay() expects the raw file content as a String, not a file path. You can see an example of this in Mode: https://github.com/HaxeFlixel/flixel-demos/blob/2.2.0/Platformers/Mode/source/MenuState.hx#L222

    You need to use openfl.Assets.getText() on your file path.


Log in to reply