I'm trying to set up a save function in my HaxeFlixel game.
Some background: The object in question is an instance of Player
, which extends FlxSprite
. Save data is stored in an instance of a custom class I made for it. That instance is stored in a StringMap
(the keys are save names), which is saved by serializing it to a variable in a FlxSave
.
Creating the save data and writing it works fine. However, reading the save data back in crashes the game with the message "Invalid field: pixels". pixels
is a field from FlxSprite, but it's not the first such field in the serialized string, so it's probably not that.
If it's useful, the declaration of that field is y6:pixelsn
- that is:
y
begin a field, which is named...6:
a string of length 6...pixels
(the string)n
null