Permalink
Browse files

misc timer fixes and other things i think

  • Loading branch information...
1 parent 45adcc7 commit 40ba84e63e01a2617b7d26f3086f61f82ce53b50 @AdamAtomic committed May 1, 2011
Showing with 20 additions and 17 deletions.
  1. +11 −7 org/flixel/FlxObject.as
  2. +0 −1 org/flixel/FlxParticle.as
  3. +1 −1 org/flixel/FlxTilemap.as
  4. +8 −8 org/flixel/FlxTimer.as
View
@@ -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)
@@ -80,7 +80,6 @@ package org.flixel
else
drag.x = 0;
}
- return;
}
/**
View
@@ -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;
View
@@ -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()
{
@@ -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;
}
@@ -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."
@@ -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;
@@ -131,6 +128,9 @@ package org.flixel
public function stop():void
{
finished = true;
+ var timerManager:TimerManager = manager;
+ if(timerManager != null)
+ timerManager.remove(this);
}
/**

0 comments on commit 40ba84e

Please sign in to comment.