mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix various small bugs
This commit is contained in:
parent
bde64220f3
commit
efcf3dc307
3 changed files with 16 additions and 4 deletions
|
|
@ -848,8 +848,14 @@ class Marble extends GameObject {
|
|||
normP.scale(1 + bounce);
|
||||
|
||||
velocity.load(velocity.sub(normP.multiply(1 / ourMass)));
|
||||
if (Math.isNaN(velocity.lengthSq())) {
|
||||
velocity.set(0, 0, 0);
|
||||
}
|
||||
|
||||
otherMarble.velocity.load(otherMarble.velocity.add(normP.multiply(1 / theirMass)));
|
||||
if (Math.isNaN(otherMarble.velocity.lengthSq())) {
|
||||
otherMarble.velocity.set(0, 0, 0);
|
||||
}
|
||||
contacts[i].velocity.load(otherMarble.velocity);
|
||||
} else {
|
||||
if (contacts[i].velocity.length() == 0 && !surfaceSlide && surfaceDot > -this._maxDotSlide * velLen) {
|
||||
|
|
@ -1534,6 +1540,8 @@ class Marble extends GameObject {
|
|||
}
|
||||
|
||||
function nudgeToContacts(position:Vector, radius:Float, foundContacts:Array<MarbleTestMoveFoundContact>, foundMarbles:Array<SphereCollisionEntity>) {
|
||||
if (Net.isMP)
|
||||
return position;
|
||||
var it = 0;
|
||||
var concernedContacts = foundContacts; // PathedInteriors have their own nudge logic
|
||||
var prevResolved = 0;
|
||||
|
|
@ -1727,8 +1735,8 @@ class Marble extends GameObject {
|
|||
tdiff = diff;
|
||||
}
|
||||
var expectedPos = finalPosData.position;
|
||||
var newPos = expectedPos;
|
||||
// var newPos = nudgeToContacts(expectedPos, _radius, finalPosData.foundContacts, finalPosData.foundMarbles);
|
||||
// var newPos = expectedPos;
|
||||
var newPos = nudgeToContacts(expectedPos, _radius, finalPosData.foundContacts, finalPosData.foundMarbles);
|
||||
|
||||
if (this.velocity.lengthSq() > 1e-8) {
|
||||
var posDiff = newPos.sub(expectedPos);
|
||||
|
|
@ -1847,6 +1855,9 @@ class Marble extends GameObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (Net.isClient && this.megaMarbleUseTick == 0) {
|
||||
this.collider.radius = this._radius = 0.3;
|
||||
}
|
||||
|
||||
if (Net.isMP) {
|
||||
if (m.jump && this.outOfBounds) {
|
||||
|
|
|
|||
|
|
@ -1095,9 +1095,9 @@ class MarbleWorld extends Scheduler {
|
|||
|
||||
public function addMarble(marble:Marble, client:GameConnection, onFinish:Void->Void) {
|
||||
marble.level = cast this;
|
||||
this.marbles.push(marble);
|
||||
if (marble.controllable) {
|
||||
marble.init(cast this, client, () -> {
|
||||
this.marbles.push(marble);
|
||||
this.scene.addChild(marble.camera);
|
||||
this.marble = marble;
|
||||
// Ugly hack
|
||||
|
|
@ -1110,6 +1110,7 @@ class MarbleWorld extends Scheduler {
|
|||
});
|
||||
} else {
|
||||
marble.init(cast this, client, () -> {
|
||||
this.marbles.push(marble);
|
||||
marble.collisionWorld = this.collisionWorld;
|
||||
this.collisionWorld.addMovingEntity(marble.collider);
|
||||
this.collisionWorld.addMarbleEntity(marble.collider);
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ class EndGameGui extends GuiImage {
|
|||
if (scoreType == Score)
|
||||
egResultRight.text.text = '<font color="#8DFF8D">${Util.formatScore(score)}</font><br/><font color="#EBEBEB">${Util.formatScore(bestScore.time)}</font>';
|
||||
if (scoreType == Time)
|
||||
egResultRight.text.text = '<font color="${beatPar ? "#8DFF8D" : "0xFF7575"}">${Util.formatTime(score)}</font><br/><font color="#88BCEE">${Util.formatTime(mission.qualifyTime)}</font><br/><font color="#EBEBEB">${rating}</font><br/><font color="#EBEBEB">${Util.formatTime(bestScore.time)}</font>';
|
||||
egResultRight.text.text = '<font color="${beatPar ? "#8DFF8D" : "#FF7575"}">${Util.formatTime(score)}</font><br/><font color="#88BCEE">${Util.formatTime(mission.qualifyTime)}</font><br/><font color="#EBEBEB">${rating}</font><br/><font color="#EBEBEB">${Util.formatTime(bestScore.time)}</font>';
|
||||
endGameWnd.addChild(egResultRight);
|
||||
|
||||
var bottomBar = new GuiControl();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue