-
Couldn't load subscription status.
- Fork 484
Closed
Description
I'm calling loadmap as such:
foo.loadMap(Assets.getText("assets/foo.txt"), "assets/my_image.png", x, y, FlxTilemap.OFF);with a foo.txt that looks like:
0,0,0,0,0
1,0,0,0,0
0,0,0,0,0
0,0,0,0,0
1,1,1,1,1
~this is a newline character~
having a newline character at the end of the file (to make it a valid text file), which is allowed by the CSV format causes this call to silently fail.
On OSX under the neko and native target I'm getting back:
trace(foo.widthInTiles); // this prints 0Looking into how FlxTilemap is implemented if the last line is a newline, it fails the whole call (silently).
To fix this, you need to call loadMap as such:
foo.loadMap(StringTools.rtrim(Assets.getText("assets/foo.txt")), "assets/my_image.png", x, y, FlxTilemap.OFF);It seems like it would make more sense to have that call to StringTools.rtrim in loadMap, or at the very least throw an exception saying that whitespace isn't allowed at the end of the CSVs.
Metadata
Metadata
Assignees
Labels
No labels