Skip to content

Commit 2886406

Browse files
committed
Merge pull request AdamAtomic#70 from moly/fix_#220
fixed #12, AdamAtomic#220 Incorrect value for moves in FlxText, FlxTileblock and FlxTilemap
2 parents adfb381 + 93d3f6b commit 2886406

File tree

6 files changed

+24
-6
lines changed

6 files changed

+24
-6
lines changed

org/flixel/FlxG.as

+13-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ package org.flixel
246246
static public function log(Data:Object):void
247247
{
248248
if((_game != null) && (_game._debugger != null))
249-
_game._debugger.log.add((Data == null)?"ERROR: null object":Data.toString());
249+
_game._debugger.log.add((Data == null)?"ERROR: null object":((Data is Array)?FlxU.formatArray(Data as Array):Data.toString()));
250250
}
251251

252252
/**
@@ -322,6 +322,18 @@ package org.flixel
322322
_game._maxAccumulation = _game._step;
323323
}
324324

325+
/**
326+
* Switch to full-screen display.
327+
*/
328+
static public function fullscreen():void
329+
{
330+
FlxG.stage.displayState = "fullScreen";
331+
var fsw:uint = FlxG.width*FlxG.camera.zoom;
332+
var fsh:uint = FlxG.height*FlxG.camera.zoom;
333+
FlxG.camera.x = (FlxG.stage.fullScreenWidth - fsw)/2;
334+
FlxG.camera.y = (FlxG.stage.fullScreenHeight - fsh)/2;
335+
}
336+
325337
/**
326338
* Generates a random number. Deterministic, meaning safe
327339
* to use if you want to record replays in random environments.

org/flixel/FlxObject.as

+3-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ package org.flixel
196196
/**
197197
* Set this to false if you want to skip the automatic motion/movement stuff (see <code>updateMotion()</code>).
198198
* FlxObject and FlxSprite default to true.
199-
* FlxText, FlxTileblock, FlxTilemap and FlxSound default to false.
199+
* FlxText, FlxTileblock, and FlxTilemap default to false.
200200
*/
201201
public var moves:Boolean;
202202
/**
@@ -275,6 +275,8 @@ package org.flixel
275275
height = Height;
276276
mass = 1.0;
277277
elasticity = 0.0;
278+
279+
health = 1;
278280

279281
immovable = false;
280282
moves = true;

org/flixel/FlxSprite.as

-2
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ package org.flixel
166166
public function FlxSprite(X:Number=0,Y:Number=0,SimpleGraphic:Class=null)
167167
{
168168
super(X,Y);
169-
170-
health = 1;
171169

172170
_flashPoint = new Point();
173171
_flashRect = new Rectangle();

org/flixel/FlxText.as

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ package org.flixel
6464
_regen = true;
6565
_shadow = 0;
6666
allowCollisions = NONE;
67+
moves = false;
6768
calcFrame();
6869
}
6970

org/flixel/FlxTileblock.as

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package org.flixel
2525
makeGraphic(Width,Height,0,true);
2626
active = false;
2727
immovable = true;
28+
moves = false;
2829
}
2930

3031
/**

org/flixel/FlxTilemap.as

+6-2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ package org.flixel
139139
_tiles = null;
140140
_tileObjects = null;
141141
immovable = true;
142+
moves = false;
142143
cameras = null;
143144
_debugTileNotSolid = null;
144145
_debugTilePartial = null;
@@ -1361,10 +1362,11 @@ package org.flixel
13611362
* @param bitmapData A Flash <code>BitmapData</code> object, preferably black and white.
13621363
* @param Invert Load white pixels as solid instead.
13631364
* @param Scale Default is 1. Scale of 2 means each pixel forms a 2x2 block of tiles, and so on.
1365+
* @param ColorMap An array of color values (uint 0xAARRGGBB) in the order they're intended to be assigned as indices
13641366
*
13651367
* @return A comma-separated string containing the level data in a <code>FlxTilemap</code>-friendly format.
13661368
*/
1367-
static public function bitmapToCSV(bitmapData:BitmapData,Invert:Boolean=false,Scale:uint=1):String
1369+
static public function bitmapToCSV(bitmapData:BitmapData,Invert:Boolean=false,Scale:uint=1,ColorMap:Array=null):String
13681370
{
13691371
//Import and scale image if necessary
13701372
if(Scale > 1)
@@ -1390,7 +1392,9 @@ package org.flixel
13901392
{
13911393
//Decide if this pixel/tile is solid (1) or not (0)
13921394
pixel = bitmapData.getPixel(column,row);
1393-
if((Invert && (pixel > 0)) || (!Invert && (pixel == 0)))
1395+
if(ColorMap != null)
1396+
pixel = ColorMap.indexOf(pixel);
1397+
else if((Invert && (pixel > 0)) || (!Invert && (pixel == 0)))
13941398
pixel = 1;
13951399
else
13961400
pixel = 0;

0 commit comments

Comments
 (0)