mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix rewind particles
This commit is contained in:
parent
e6b5dbbb25
commit
35d215412f
3 changed files with 14 additions and 4 deletions
|
|
@ -1005,6 +1005,8 @@ class MarbleWorld extends Scheduler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var realDt = dt;
|
||||||
|
|
||||||
if (Key.isDown(Key.R)) {
|
if (Key.isDown(Key.R)) {
|
||||||
this.rewinding = true;
|
this.rewinding = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1085,6 +1087,9 @@ class MarbleWorld extends Scheduler {
|
||||||
ProfilerUI.measure("updateInstances");
|
ProfilerUI.measure("updateInstances");
|
||||||
this.instanceManager.render();
|
this.instanceManager.render();
|
||||||
ProfilerUI.measure("updateParticles");
|
ProfilerUI.measure("updateParticles");
|
||||||
|
if (this.rewinding) {
|
||||||
|
this.particleManager.update(1000 * timeState.timeSinceLoad, -realDt);
|
||||||
|
} else
|
||||||
this.particleManager.update(1000 * timeState.timeSinceLoad, dt);
|
this.particleManager.update(1000 * timeState.timeSinceLoad, dt);
|
||||||
ProfilerUI.measure("updatePlayGui");
|
ProfilerUI.measure("updatePlayGui");
|
||||||
this.playGui.update(timeState);
|
this.playGui.update(timeState);
|
||||||
|
|
|
||||||
|
|
@ -76,13 +76,13 @@ class Particle {
|
||||||
var elapsed = time - this.spawnTime;
|
var elapsed = time - this.spawnTime;
|
||||||
var completion = Util.clamp(elapsed / this.lifeTime, 0, 1);
|
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);
|
this.manager.removeParticle(this.data, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (completion == 1) {
|
if (completion == 1 || completion < 0) {
|
||||||
// The particle can die
|
// The particle can die
|
||||||
this.manager.removeParticle(this.data, this);
|
this.manager.removeParticle(this.data, this);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ typedef ControlsSettings = {
|
||||||
var invertYAxis:Bool;
|
var invertYAxis:Bool;
|
||||||
var respawn:Int;
|
var respawn:Int;
|
||||||
var blast:Int;
|
var blast:Int;
|
||||||
|
var rewind:Int;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef TouchSettings = {
|
typedef TouchSettings = {
|
||||||
|
|
@ -143,7 +144,8 @@ class Settings {
|
||||||
cameraSensitivity: 0.6,
|
cameraSensitivity: 0.6,
|
||||||
invertYAxis: false,
|
invertYAxis: false,
|
||||||
respawn: Key.BACKSPACE,
|
respawn: Key.BACKSPACE,
|
||||||
blast: Key.E
|
blast: Key.E,
|
||||||
|
rewind: Key.R,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static var touchSettings:TouchSettings = {
|
public static var touchSettings:TouchSettings = {
|
||||||
|
|
@ -396,6 +398,9 @@ class Settings {
|
||||||
if (controlsSettings.blast == null) {
|
if (controlsSettings.blast == null) {
|
||||||
controlsSettings.blast = Key.E;
|
controlsSettings.blast = Key.E;
|
||||||
}
|
}
|
||||||
|
if (controlsSettings.rewind == null) {
|
||||||
|
controlsSettings.rewind = Key.R;
|
||||||
|
}
|
||||||
#end
|
#end
|
||||||
highscoreName = json.highscoreName;
|
highscoreName = json.highscoreName;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue