FlixelCommunity / flixel

Community fork of Adam “Atomic” Saltsman's popular game engine Flixel. Distilled from a variety of Flash games he worked on over the last couple years, including Gravity Hook, Fathom and Canabalt, its primary function is to provide some useful base classes that you can extend to make your own game objects.
http://flixelcommunity.org/
Other
84 stars 17 forks source link

FlxTilemap() can't draw one-column tilemap - BitmaData exception #212

Closed antongrechko closed 10 years ago

antongrechko commented 10 years ago

When I try to call loadMap(FlxTilemap.arrayToCSV(constructBoundsArray("LEFT"), 1) ... flash throws

ArgumentError: Error #2015: Invalid BitmapData.
    at flash.display::BitmapData/ctor()
    at flash.display::BitmapData()
    at org.flixel.system::FlxTilemapBuffer()[E:\workspace-flash\frameworks\AdamAtomic-flixel-8989e50\org\flixel\system\FlxTilemapBuffer.as:72]
    at org.flixel::FlxTilemap/draw()[E:\workspace-flash\frameworks\AdamAtomic-flixel-8989e50\org\flixel\FlxTilemap.as:426]

It making impossible to draw a "one-column" tilemap (border for something, as example) Fix is: in FlxTilemap.loadMap() function find rows

                columns = rows[row++].split(",");
                if(columns.length <= 1)

replace <= with < That should work.

Dovyski commented 10 years ago

Thanks for the report and the fix. We should work on this issue soon.

Gama11 commented 10 years ago

Thanks, now fixed in HaxeFlixel. :thumbsup:

WingEraser commented 10 years ago

Many thanks from flixel-gdx :+1:

Dovyski commented 10 years ago

It took us a while, but it's fixed in Flixel Community too :D Landed in https://github.com/FlixelCommunity/flixel/commit/3f66f8da48acafbe431235e00e6a4633acee6544.