Skip to content

Commit

Permalink
Merge pull request AdamAtomic#70 from moly/fix_#220
Browse files Browse the repository at this point in the history
fixed #12, AdamAtomic#220 Incorrect value for moves in FlxText, FlxTileblock and FlxTilemap
  • Loading branch information
moly committed Sep 15, 2012
2 parents adfb381 + 93d3f6b commit 2886406
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
14 changes: 13 additions & 1 deletion org/flixel/FlxG.as
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ package org.flixel
static public function log(Data:Object):void
{
if((_game != null) && (_game._debugger != null))
_game._debugger.log.add((Data == null)?"ERROR: null object":Data.toString());
_game._debugger.log.add((Data == null)?"ERROR: null object":((Data is Array)?FlxU.formatArray(Data as Array):Data.toString()));
}

/**
Expand Down Expand Up @@ -322,6 +322,18 @@ package org.flixel
_game._maxAccumulation = _game._step;
}

/**
* Switch to full-screen display.
*/
static public function fullscreen():void
{
FlxG.stage.displayState = "fullScreen";
var fsw:uint = FlxG.width*FlxG.camera.zoom;
var fsh:uint = FlxG.height*FlxG.camera.zoom;
FlxG.camera.x = (FlxG.stage.fullScreenWidth - fsw)/2;
FlxG.camera.y = (FlxG.stage.fullScreenHeight - fsh)/2;
}

/**
* Generates a random number. Deterministic, meaning safe
* to use if you want to record replays in random environments.
Expand Down
4 changes: 3 additions & 1 deletion org/flixel/FlxObject.as
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ package org.flixel
/**
* Set this to false if you want to skip the automatic motion/movement stuff (see <code>updateMotion()</code>).
* FlxObject and FlxSprite default to true.
* FlxText, FlxTileblock, FlxTilemap and FlxSound default to false.
* FlxText, FlxTileblock, and FlxTilemap default to false.
*/
public var moves:Boolean;
/**
Expand Down Expand Up @@ -275,6 +275,8 @@ package org.flixel
height = Height;
mass = 1.0;
elasticity = 0.0;

health = 1;

immovable = false;
moves = true;
Expand Down
2 changes: 0 additions & 2 deletions org/flixel/FlxSprite.as
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ package org.flixel
public function FlxSprite(X:Number=0,Y:Number=0,SimpleGraphic:Class=null)
{
super(X,Y);

health = 1;

_flashPoint = new Point();
_flashRect = new Rectangle();
Expand Down
1 change: 1 addition & 0 deletions org/flixel/FlxText.as
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ package org.flixel
_regen = true;
_shadow = 0;
allowCollisions = NONE;
moves = false;
calcFrame();
}

Expand Down
1 change: 1 addition & 0 deletions org/flixel/FlxTileblock.as
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package org.flixel
makeGraphic(Width,Height,0,true);
active = false;
immovable = true;
moves = false;
}

/**
Expand Down
8 changes: 6 additions & 2 deletions org/flixel/FlxTilemap.as
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ package org.flixel
_tiles = null;
_tileObjects = null;
immovable = true;
moves = false;
cameras = null;
_debugTileNotSolid = null;
_debugTilePartial = null;
Expand Down Expand Up @@ -1361,10 +1362,11 @@ package org.flixel
* @param bitmapData A Flash <code>BitmapData</code> object, preferably black and white.
* @param Invert Load white pixels as solid instead.
* @param Scale Default is 1. Scale of 2 means each pixel forms a 2x2 block of tiles, and so on.
* @param ColorMap An array of color values (uint 0xAARRGGBB) in the order they're intended to be assigned as indices
*
* @return A comma-separated string containing the level data in a <code>FlxTilemap</code>-friendly format.
*/
static public function bitmapToCSV(bitmapData:BitmapData,Invert:Boolean=false,Scale:uint=1):String
static public function bitmapToCSV(bitmapData:BitmapData,Invert:Boolean=false,Scale:uint=1,ColorMap:Array=null):String
{
//Import and scale image if necessary
if(Scale > 1)
Expand All @@ -1390,7 +1392,9 @@ package org.flixel
{
//Decide if this pixel/tile is solid (1) or not (0)
pixel = bitmapData.getPixel(column,row);
if((Invert && (pixel > 0)) || (!Invert && (pixel == 0)))
if(ColorMap != null)
pixel = ColorMap.indexOf(pixel);
else if((Invert && (pixel > 0)) || (!Invert && (pixel == 0)))
pixel = 1;
else
pixel = 0;
Expand Down

0 comments on commit 2886406

Please sign in to comment.