Created
March 2, 2026 01:41
-
-
Save spillz/e47ad2893b4dbc5415aa3b69f2ba52f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` | |
| diff --git a/c:\Users\damie\source\dropship\src/loop.js b/c:\Users\damie\source\dropship\src/loop.js | |
| --- a/c:\Users\damie\source\dropship\src/loop.js | |
| +++ b/c:\Users\damie\source\dropship\src/loop.js | |
| @@ -634,29 +634,9 @@ | |
| */ | |
| - _step(dt, inputState){ | |
| - const { left, right, thrust, down, reset, shoot, bomb, aim, aimShoot, aimBomb, aimShootFrom, aimShootTo, aimBombFrom, aimBombTo } = inputState; | |
| - if (reset) this._resetShip(); | |
| - const aimWorldShoot = this._toWorldFromAim(aimShoot || aim); | |
| - const aimWorldBomb = this._toWorldFromAim(aimBomb || aimShoot || aim); | |
| - let aimWorld = (aimShootTo && this._toWorldFromAim(aimShootTo)) || aimWorldShoot || (aimBombTo && this._toWorldFromAim(aimBombTo)) || aimWorldBomb; | |
| - if ((aimShootFrom && aimShootTo) || (aimBombFrom && aimBombTo)){ | |
| - const from = aimShootFrom || aimBombFrom; | |
| - const to = aimShootTo || aimBombTo; | |
| - const wFrom = from ? this._toWorldFromAim(from) : null; | |
| - const wTo = to ? this._toWorldFromAim(to) : null; | |
| - if (wFrom && wTo){ | |
| - const dx = wTo.x - wFrom.x; | |
| - const dy = wTo.y - wFrom.y; | |
| - const dist = Math.hypot(dx, dy) || 1; | |
| - const dirx = dx / dist; | |
| - const diry = dy / dist; | |
| - const aimLen = Math.max(4.0, this._aimWorldDistance(GAME.AIM_SCREEN_RADIUS || 0.25)); | |
| - aimWorld = { x: this.ship.x + dirx * aimLen, y: this.ship.y + diry * aimLen }; | |
| - } | |
| - } | |
| - this.lastAimWorld = aimWorld; | |
| - if (inputState.aim) this.lastAimScreen = inputState.aim; | |
| - | |
| - if (this.ship.hitCooldown > 0){ | |
| - this.ship.hitCooldown = Math.max(0, this.ship.hitCooldown - dt); | |
| - } | |
| + _step(dt, inputState){ | |
| + const { left, right, thrust, down, reset, shoot, bomb, aim, aimShoot, aimBomb, aimShootFrom, aimShootTo, aimBombFrom, aimBombTo } = inputState; | |
| + if (reset) this._resetShip(); | |
| + | |
| + if (this.ship.hitCooldown > 0){ | |
| + this.ship.hitCooldown = Math.max(0, this.ship.hitCooldown - dt); | |
| + } | |
| @@ -822,8 +802,29 @@ | |
| } | |
| - } | |
| - } | |
| - } | |
| - | |
| - if (this.ship.state !== "crashed"){ | |
| - if (shoot){ | |
| + } | |
| + } | |
| + } | |
| + | |
| + const aimWorldShoot = this._toWorldFromAim(aimShoot || aim); | |
| + const aimWorldBomb = this._toWorldFromAim(aimBomb || aimShoot || aim); | |
| + let aimWorld = (aimShootTo && this._toWorldFromAim(aimShootTo)) || aimWorldShoot || (aimBombTo && this._toWorldFromAim(aimBombTo)) || aimWorldBomb; | |
| + if ((aimShootFrom && aimShootTo) || (aimBombFrom && aimBombTo)){ | |
| + const from = aimShootFrom || aimBombFrom; | |
| + const to = aimShootTo || aimBombTo; | |
| + const wFrom = from ? this._toWorldFromAim(from) : null; | |
| + const wTo = to ? this._toWorldFromAim(to) : null; | |
| + if (wFrom && wTo){ | |
| + const dx = wTo.x - wFrom.x; | |
| + const dy = wTo.y - wFrom.y; | |
| + const dist = Math.hypot(dx, dy) || 1; | |
| + const dirx = dx / dist; | |
| + const diry = dy / dist; | |
| + const aimLen = Math.max(4.0, this._aimWorldDistance(GAME.AIM_SCREEN_RADIUS || 0.25)); | |
| + aimWorld = { x: this.ship.x + dirx * aimLen, y: this.ship.y + diry * aimLen }; | |
| + } | |
| + } | |
| + this.lastAimWorld = aimWorld; | |
| + if (inputState.aim) this.lastAimScreen = inputState.aim; | |
| + | |
| + if (this.ship.state !== "crashed"){ | |
| + if (shoot){ | |
| let dirx = 0, diry = 0; | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment