Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
fix: move variables
Browse files Browse the repository at this point in the history
  • Loading branch information
lishaduck committed Jan 13, 2024
1 parent 6265c65 commit 77aae16
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ let y2: number;
let flr2: Lvl;
let sx1: number;
let sy1: number;
let px = 1;
let py = 1;
let old: number;

library.add(
faXmark,
Expand Down Expand Up @@ -405,15 +408,15 @@ function pathCalculationInternals(

Object.values(stairs).forEach(
([first, second]: Coords2D, index: number): void => {
const distance =
Math.abs(x1 - first) +
Math.abs(y1 - second) +
Math.abs(x2 - first) +
Math.abs(y2 - second);

if (distance < minData.min) {
minData = { min: distance, minIndex: index };
}
const distance =
Math.abs(x1 - first) +
Math.abs(y1 - second) +
Math.abs(x2 - first) +
Math.abs(y2 - second);

if (distance < minData.min) {
minData = { min: distance, minIndex: index };
}
},
);

Expand Down Expand Up @@ -650,10 +653,6 @@ async function startApp(): Promise<void> {
}
window.startApp = startApp;

let px = 1;
let py = 1;
let old: number;

function onKeyDown(event: KeyboardEvent): void {
switch (viewLvl) {
case 1: {
Expand Down

0 comments on commit 77aae16

Please sign in to comment.