Skip to content

Commit

Permalink
misc timer fixes and other things i think
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamAtomic committed May 1, 2011
1 parent 45adcc7 commit 40ba84e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
18 changes: 11 additions & 7 deletions org/flixel/FlxObject.as
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,20 @@ package org.flixel
*
* @return The node (a <code>FlxPoint</code> object) we are aiming for next.
*/
protected function advancePath():FlxPoint
protected function advancePath(Snap:Boolean=true):FlxPoint
{
var oldNode:FlxPoint = path.nodes[_pathNodeIndex];
if(oldNode != null)
if(Snap)
{
if((_pathMode & PATH_VERTICAL_ONLY) == 0)
x = oldNode.x - width*0.5;
if((_pathMode & PATH_HORIZONTAL_ONLY) == 0)
y = oldNode.y - height*0.5;
var oldNode:FlxPoint = path.nodes[_pathNodeIndex];
if(oldNode != null)
{
if((_pathMode & PATH_VERTICAL_ONLY) == 0)
x = oldNode.x - width*0.5;
if((_pathMode & PATH_HORIZONTAL_ONLY) == 0)
y = oldNode.y - height*0.5;
}
}

_pathNodeIndex += _pathInc;

if((_pathMode & PATH_BACKWARD) > 0)
Expand Down
1 change: 0 additions & 1 deletion org/flixel/FlxParticle.as
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ package org.flixel
else
drag.x = 0;
}
return;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion org/flixel/FlxTilemap.as
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ package org.flixel
{
if(_data[i] == Index)
{
point = new FlxPoint(uint(i%widthInTiles)*_tileWidth,uint(i/widthInTiles)*_tileHeight);
point = new FlxPoint(x + uint(i%widthInTiles)*_tileWidth,y + uint(i/widthInTiles)*_tileHeight);
if(Midpoint)
{
point.x += _tileWidth*0.5;
Expand Down
16 changes: 8 additions & 8 deletions org/flixel/FlxTimer.as
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ package org.flixel

/**
* Instantiate the timer. Does not set or start the timer.
* Does, however, automatically add the timer to the timer manager.
*/
public function FlxTimer()
{
Expand All @@ -57,20 +56,13 @@ package org.flixel

paused = false;
finished = false;

var timerManager:TimerManager = manager;
if(timerManager != null)
timerManager.add(this);
}

/**
* Clean up memory.
*/
public function destroy():void
{
var timerManager:TimerManager = manager;
if(timerManager != null)
timerManager.remove(this);
stop();
_callback = null;
}
Expand Down Expand Up @@ -100,6 +92,7 @@ package org.flixel
/**
* Starts or resumes the timer. If this timer was paused,
* then all the parameters are ignored, and the timer is resumed.
* Adds the timer to the timer manager.
*
* @param Time How many seconds it takes for the timer to go off.
* @param Loops How many times the timer should go off. Default is 1, or "just count down once."
Expand All @@ -109,6 +102,10 @@ package org.flixel
*/
public function start(Time:Number=1,Loops:uint=1,Callback:Function=null):FlxTimer
{
var timerManager:TimerManager = manager;
if(timerManager != null)
timerManager.add(this);

if(paused)
{
paused = false;
Expand All @@ -131,6 +128,9 @@ package org.flixel
public function stop():void
{
finished = true;
var timerManager:TimerManager = manager;
if(timerManager != null)
timerManager.remove(this);
}

/**
Expand Down

0 comments on commit 40ba84e

Please sign in to comment.