mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 13:11:42 +00:00
fix super speed and easter egg
This commit is contained in:
parent
a43a13dbd9
commit
1aad5ef361
2 changed files with 10 additions and 11 deletions
|
|
@ -16,6 +16,7 @@ class EasterEgg extends PowerUp {
|
||||||
this.pickUpName = "Easter Egg";
|
this.pickUpName = "Easter Egg";
|
||||||
this.autoUse = true;
|
this.autoUse = true;
|
||||||
this.sharedNodeTransforms = true;
|
this.sharedNodeTransforms = true;
|
||||||
|
this.cooldownDuration = 1e8;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pickUp(marble:Marble):Bool {
|
public function pickUp(marble:Marble):Bool {
|
||||||
|
|
|
||||||
|
|
@ -72,21 +72,19 @@ class SuperSpeed extends PowerUp {
|
||||||
public function use(marble:Marble, timeState:TimeState) {
|
public function use(marble:Marble, timeState:TimeState) {
|
||||||
var movementVector = marble.getMarbleAxis()[0];
|
var movementVector = marble.getMarbleAxis()[0];
|
||||||
|
|
||||||
// Okay, so super speed directionality is a bit strange. In general, the direction is based on the normal vector of the last surface you had contact with.
|
var boostVec = movementVector.clone();
|
||||||
|
|
||||||
// var quat = level.newOrientationQuat;
|
var contactDot = movementVector.dot(marble.lastContactNormal);
|
||||||
// movementVector.applyQuaternion(quat);
|
boostVec.load(boostVec.sub(marble.lastContactNormal.multiply(contactDot)));
|
||||||
|
if (boostVec.lengthSq() > 0.01) {
|
||||||
|
boostVec.normalize();
|
||||||
|
} else {
|
||||||
|
boostVec.load(movementVector);
|
||||||
|
}
|
||||||
|
|
||||||
var quat2 = new Quat();
|
|
||||||
// Determine the necessary rotation to rotate the up vector to the contact normal.
|
|
||||||
quat2.initMoveTo(marble.currentUp, marble.lastContactNormal);
|
|
||||||
movementVector.transform(quat2.toMatrix());
|
|
||||||
var masslessFactor = marble.getMass() * 0.7 + 1 - 0.7;
|
var masslessFactor = marble.getMass() * 0.7 + 1 - 0.7;
|
||||||
marble.velocity = marble.velocity.add(movementVector.multiply(-25 * masslessFactor / marble.getMass()));
|
marble.velocity = marble.velocity.add(boostVec.multiply(-25 * masslessFactor / marble.getMass()));
|
||||||
|
|
||||||
// marble.body.addLinearVelocity(Util.vecThreeToOimo(movementVector).scale(24.7)); // Whirligig's determined value
|
|
||||||
// marble.body.addLinearVelocity(this.level.currentUp.scale(20)); // Simply add to vertical velocity
|
|
||||||
// if (!this.level.rewinding)
|
|
||||||
if (level.marble == marble && @:privateAccess !marble.isNetUpdate)
|
if (level.marble == marble && @:privateAccess !marble.isNetUpdate)
|
||||||
AudioManager.playSound(ResourceLoader.getResource("data/sound/use_speed.wav", ResourceLoader.getAudio, this.soundResources));
|
AudioManager.playSound(ResourceLoader.getResource("data/sound/use_speed.wav", ResourceLoader.getAudio, this.soundResources));
|
||||||
if (@:privateAccess !marble.isNetUpdate)
|
if (@:privateAccess !marble.isNetUpdate)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue