Skip to content

Commit 3202da9

Browse files
committed
change bullet delay frames to feel more fluid
1 parent 20e3b0c commit 3202da9

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

server-client/src/client-static/src/shellshock.min.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,7 +2288,19 @@ function BulletActor(bullet) {
22882288
this.mesh.setEnabled(false)
22892289
}
22902290
BulletActor.prototype.fire = function () {
2291-
this.bullet.player.id == meId ? this.delayFrames = Math.ceil(ping / 17) + 5 : this.delayFrames = 5, this.mesh.position.x = this.bullet.x, this.mesh.position.y = this.bullet.y, this.mesh.position.z = this.bullet.z, this.mesh.lookAt(new BABYLON.Vector3(this.bullet.x + this.bullet.dx, this.bullet.y + this.bullet.dy, this.bullet.z + this.bullet.dz)), this.mesh.rotation.x += .015, this.mesh.rotation.y -= .015, this.mesh.scaling.z = .5
2291+
this.delayFrames = 2;
2292+
2293+
if (this.bullet.player.id == meId) {
2294+
this.delayFrames += Math.max(0, Math.ceil((ping - 75) / 17));
2295+
};
2296+
2297+
this.mesh.position.x = this.bullet.x;
2298+
this.mesh.position.y = this.bullet.y;
2299+
this.mesh.position.z = this.bullet.z;
2300+
this.mesh.lookAt(new BABYLON.Vector3(this.bullet.x + this.bullet.dx, this.bullet.y + this.bullet.dy, this.bullet.z + this.bullet.dz));
2301+
this.mesh.rotation.x += .015;
2302+
this.mesh.rotation.y -= .015;
2303+
this.mesh.scaling.z = .5;
22922304

22932305
plugins.emit('bulletActorFired', { bulletActor: this });
22942306
};
@@ -2313,7 +2325,14 @@ function RocketActor(rocket) {
23132325
this.flySound = "rpegg.fly";
23142326
}
23152327
RocketActor.prototype.fire = function () {
2316-
this.armed = false, this.rocket.player.id == meId ? this.delayFrames = Math.ceil(ping / 17) + 3 : this.delayFrames = 3, this.mesh.position.x = this.rocket.x, this.mesh.position.y = this.rocket.y, this.mesh.position.z = this.rocket.z, this.mesh.lookAt(new BABYLON.Vector3(this.rocket.x + this.rocket.dx, this.rocket.y + this.rocket.dy, this.rocket.z + this.rocket.dz)), this.mesh.rotation.x += .015, this.mesh.rotation.y -= .015
2328+
this.armed = false;
2329+
this.rocket.player.id == meId ? this.delayFrames = Math.ceil(ping / 17) + 3 : this.delayFrames = 3;
2330+
this.mesh.position.x = this.rocket.x;
2331+
this.mesh.position.y = this.rocket.y;
2332+
this.mesh.position.z = this.rocket.z;
2333+
this.mesh.lookAt(new BABYLON.Vector3(this.rocket.x + this.rocket.dx, this.rocket.y + this.rocket.dy, this.rocket.z + this.rocket.dz));
2334+
this.mesh.rotation.x += .015;
2335+
this.mesh.rotation.y -= .015;
23172336
};
23182337
RocketActor.prototype.update = function () {
23192338
if (--this.delayFrames <= 0 && this.mesh.setEnabled(true), !this.armed && this.rocket.ttArmed <= 0 && (this.armed = true,this.soundEmitter.play(this.flySound)), this.delayFrames % 4 == 0) {
@@ -2322,7 +2341,9 @@ RocketActor.prototype.update = function () {
23222341
dz = .04 * Math.random() - .02;
23232342
this.rocket.ttArmed <= 0 && (addExplosionSprite(explosionSmokeManager, 10, this.rocket.x, this.rocket.y, this.rocket.z, dx, dy, dz, .4), addExplosionSprite(explosionFireManager, 10, this.rocket.x, this.rocket.y, this.rocket.z, dx, dy, dz, .4))
23242343
}
2325-
this.mesh.position.x = this.rocket.x, this.mesh.position.y = this.rocket.y, this.mesh.position.z = this.rocket.z
2344+
this.mesh.position.x = this.rocket.x;
2345+
this.mesh.position.y = this.rocket.y;
2346+
this.mesh.position.z = this.rocket.z;
23262347
};
23272348
RocketActor.prototype.remove = function () {
23282349
this.mesh.setEnabled(false)

0 commit comments

Comments
 (0)