From bd7b0ac62fc9f60496786b95031dd75f08018bd7 Mon Sep 17 00:00:00 2001 From: Elijah Lucian Date: Sat, 20 Mar 2021 19:32:45 -0700 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=98=AD=F0=9F=A4=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webclient/src/light.css | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/webclient/src/light.css b/webclient/src/light.css index 4a35765..62b430e 100644 --- a/webclient/src/light.css +++ b/webclient/src/light.css @@ -124,13 +124,15 @@ body { display: grid; } -.footer-content { - transition: all 0.2s ease-in; - opacity: 0.25; -} +@media (min-width: 650px) { + .footer-content { + transition: all 0.2s ease-in; + opacity: 0.25; + } -.footer-content:hover { - opacity: 1; + .footer-content:hover { + opacity: 1; + } } /* grid bottom */ From 8874850b2fa3ac36b07e5f2420ae57961d0e86ff Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 21 Mar 2021 02:22:22 +0000 Subject: [PATCH 2/2] Delete bolts that are far away --- webclient/src/spaceport/Laser.js | 5 +++++ webclient/src/spaceport/Ship.js | 12 ++++++++---- webclient/src/spaceport/scene.js | 5 +++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/webclient/src/spaceport/Laser.js b/webclient/src/spaceport/Laser.js index a2c5a40..e4f2690 100644 --- a/webclient/src/spaceport/Laser.js +++ b/webclient/src/spaceport/Laser.js @@ -6,6 +6,7 @@ export class Laser { constructor(ship) { const position = new THREE.Vector3(); this.direction = ship.direction; + this.kill = false; ship.mesh.getWorldPosition(position) @@ -28,5 +29,9 @@ export class Laser { update({ deltaTime }) { this.mesh.position.z += 0.5 * this.direction; + + if (Math.abs(this.mesh.position.z > 475/2)) { + this.kill = true; + } } } diff --git a/webclient/src/spaceport/Ship.js b/webclient/src/spaceport/Ship.js index e49e502..95aaa7e 100644 --- a/webclient/src/spaceport/Ship.js +++ b/webclient/src/spaceport/Ship.js @@ -52,10 +52,11 @@ export class Ship { this.life -= deltaTime; if (!this.flyIn) { - const xs = Math.sin(this.life*0.5 + this.x); - this.mesh.position.y = this.y + Math.sin(this.life + this.y) * 0.08; - this.mesh.position.x = this.x + xs * 0.08; - this.mesh.rotation.y = xs*0.25; + const xs = Math.sin(this.life * 0.5 + this.x); + const yrot = Math.sin(this.life + this.x + (3.14/2 * this.direction)); + this.mesh.position.y = this.y + Math.sin(this.life + this.y) * 0.2; + this.mesh.position.x = this.x + xs * 0.15; + this.mesh.rotation.x = yrot * 0.15; this.mesh.position.z += 0.01 * this.direction; this.nextShot -= deltaTime; if (this.nextShot <= 0) { @@ -69,6 +70,9 @@ export class Ship { this.mesh.position.z += a * 2 * this.direction; this.mesh.scale.z = a * 4; this.firing = false; + + this.mesh.rotation.y = 0; + this.mesh.rotation.x = 0; } if (Math.abs(this.mesh.position.z > 475/2)) { diff --git a/webclient/src/spaceport/scene.js b/webclient/src/spaceport/scene.js index d6ea549..0cfcffc 100644 --- a/webclient/src/spaceport/scene.js +++ b/webclient/src/spaceport/scene.js @@ -82,9 +82,14 @@ export const scene = ({ ref }) => { for (const bolt of bolts) { bolt.update({ deltaTime }); + + if (bolt.kill) { + scene.remove(bolt.mesh); + } } ships = ships.filter((s) => !s.kill); + bolts = bolts.filter((s) => !s.kill); requestAnimationFrame(animate); renderer.render(scene, camera);