mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-03-06 12:01:02 +00:00
fix rewind particles
This commit is contained in:
parent
7818fb8bb5
commit
533037f95b
3 changed files with 14 additions and 4 deletions
|
|
@ -931,6 +931,8 @@ class MarbleWorld extends Scheduler {
|
|||
}
|
||||
}
|
||||
|
||||
var realDt = dt;
|
||||
|
||||
if (Key.isDown(Key.R)) {
|
||||
this.rewinding = true;
|
||||
} else {
|
||||
|
|
@ -965,7 +967,10 @@ class MarbleWorld extends Scheduler {
|
|||
ProfilerUI.measure("updateInstances");
|
||||
this.instanceManager.update(dt);
|
||||
ProfilerUI.measure("updateParticles");
|
||||
this.particleManager.update(1000 * timeState.timeSinceLoad, dt);
|
||||
if (this.rewinding) {
|
||||
this.particleManager.update(1000 * timeState.timeSinceLoad, -realDt);
|
||||
} else
|
||||
this.particleManager.update(1000 * timeState.timeSinceLoad, dt);
|
||||
ProfilerUI.measure("updatePlayGui");
|
||||
this.playGui.update(timeState);
|
||||
ProfilerUI.measure("updateAudio");
|
||||
|
|
|
|||
|
|
@ -75,13 +75,13 @@ class Particle {
|
|||
var elapsed = time - this.spawnTime;
|
||||
var completion = Util.clamp(elapsed / this.lifeTime, 0, 1);
|
||||
|
||||
if (currentAge > this.lifeTime) // Again, rewind needs this
|
||||
if (currentAge > this.lifeTime || currentAge < 0) // Again, rewind needs this
|
||||
{
|
||||
this.manager.removeParticle(this.data, this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (completion == 1) {
|
||||
if (completion == 1 || completion < 0) {
|
||||
// The particle can die
|
||||
this.manager.removeParticle(this.data, this);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ typedef ControlsSettings = {
|
|||
var alwaysFreeLook:Bool;
|
||||
var cameraSensitivity:Float;
|
||||
var invertYAxis:Bool;
|
||||
var rewind:Int;
|
||||
}
|
||||
|
||||
typedef TouchSettings = {
|
||||
|
|
@ -108,7 +109,8 @@ class Settings {
|
|||
freelook: Key.MOUSE_RIGHT,
|
||||
alwaysFreeLook: true,
|
||||
cameraSensitivity: 0.6,
|
||||
invertYAxis: false
|
||||
invertYAxis: false,
|
||||
rewind: Key.R,
|
||||
};
|
||||
|
||||
public static var touchSettings:TouchSettings = {
|
||||
|
|
@ -254,6 +256,9 @@ class Settings {
|
|||
if (json.gamepad != null) {
|
||||
gamepadSettings = json.gamepad;
|
||||
}
|
||||
if (controlsSettings.rewind == null) {
|
||||
controlsSettings.rewind = Key.R;
|
||||
}
|
||||
progression = json.progression;
|
||||
highscoreName = json.highscoreName;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue