Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions net/flashpunk/Engine.as
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
FP.assignedFrameRate = frameRate;
FP.fixed = fixed;
FP.timeInFrames = fixed;
FP._interval = 1.0 / frameRate;

// global game objects
FP.engine = this;
Expand Down
6 changes: 6 additions & 0 deletions net/flashpunk/FP.as
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
*/
public static var elapsed:Number;

/**
* The ideal interval (in fractional seconds) between frames.
*/
public static function get interval():Number { return _interval; }

/**
* Timescale applied to FP.elapsed.
*/
Expand Down Expand Up @@ -1030,6 +1035,7 @@

// Time information.
/** @private */ internal static var _time:uint;
/** @private */ internal static var _interval:Number;
/** @private */ public static var _updateTime:uint;
/** @private */ public static var _renderTime:uint;
/** @private */ public static var _gameTime:uint;
Expand Down
15 changes: 12 additions & 3 deletions net/flashpunk/graphics/Emitter.as
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,24 @@
if (!_particle) return;

// particle info
var e:Number = FP.timeInFrames ? 1 : FP.elapsed,
p:Particle = _particle,
var e:Number = FP.timeInFrames ? 1 : FP.elapsed;
simulate(e);
}

/**
* Simulate the emitter running for a given amount of time.
* @param time The time to run for, in seconds or frames depending on Engine timestep mode.
*/
public function simulate(time:Number):void
{
var p:Particle = _particle,
n:Particle;

// loop through the particles
while (p)
{
// update time scale
p._time += e;
p._time += time;

// remove on time-out
if (p._time >= p._duration)
Expand Down
7 changes: 3 additions & 4 deletions net/flashpunk/utils/Data.as
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,10 @@
}

/**
* Clears save file.
* @param filename Save file to clear.
* Clears the current data.
*/
public static function clear(filename:String):void {
Data.load(filename);
public static function clear():void
{
_shared.clear();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the desired use of clear() just to flush data in memory and not on disk? I feel this is the best approach, but I just want to make sure it is working as intended.

So, to delete a save file, a user would have to do the following:

Data.load("slot1");
Data.clear();
Data.save("slot1");

}

Expand Down