Skip to content

Commit 3c05c33

Browse files
committed
chore: tweak jump action
also: - modify random walker - tweak UI - add roads
1 parent 8201c86 commit 3c05c33

10 files changed

Lines changed: 19311 additions & 18322 deletions

model/character.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -278,22 +278,22 @@ export abstract class Character implements IChar {
278278
}
279279
} else if (this.#moveType === "jump") {
280280
this.#movePhase += 2
281-
if (this.#movePhase === 2) {
281+
if (this.#movePhase <= 2) {
282+
this.#d += 6
283+
} else if (this.#movePhase <= 4) {
282284
this.#d += 4
283-
} else if (this.#movePhase === 4) {
284-
this.#d += 3
285-
} else if (this.#movePhase === 6) {
285+
} else if (this.#movePhase <= 6) {
286+
this.#d += 2
287+
} else if (this.#movePhase <= 8) {
286288
this.#d += 1
287-
} else if (this.#movePhase === 8) {
288-
this.#d += 0
289-
} else if (this.#movePhase === 10) {
290-
this.#d -= 0
291-
} else if (this.#movePhase === 12) {
289+
} else if (this.#movePhase <= 10) {
292290
this.#d -= 1
293-
} else if (this.#movePhase === 14) {
294-
this.#d -= 3
295-
} else {
291+
} else if (this.#movePhase <= 12) {
292+
this.#d -= 2
293+
} else if (this.#movePhase <= 14) {
296294
this.#d -= 4
295+
} else {
296+
this.#d -= 6
297297
}
298298
if (this.#movePhase == 16) {
299299
this.#movePhase = 0
@@ -531,7 +531,9 @@ export class RandomWalkNPC extends Character {
531531
if (dirs.length === 0) {
532532
return undefined
533533
}
534-
const { choice } = seed(this.age.toString())
534+
const { choice } = seed(
535+
this.age.toString() + this.i.toString() + this.j.toString(),
536+
)
535537
return choice(dirs)
536538
}
537539
}

player/ui/fps-monitor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import * as signal from "../../util/signal.ts"
44
/** Monitors the current fps number */
55
export function FpsMonitor({ el }: Context) {
66
signal.fps.subscribe((fps) => {
7-
el.textContent = fps.toFixed(2)
7+
el.textContent = fps.toFixed(0)
88
})
99
}
1010

1111
/** Monitors the current v value */
1212
export function VMonitor({ el }: Context) {
1313
signal.v.subscribe((v) => {
14-
el.textContent = v.toFixed(2)
14+
el.textContent = v.toFixed(0)
1515
})
1616
}

static/index.html

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
<div
4141
class="ui-panel js-apple-counter absolute px-0.5 text-sm text-gray-400 font-8bit bg-black right-[8px] top-[8px] h-[64px] w-[64px]"
4242
>
43-
<p class="mt-0.5 flex items-start gap-0.5">
43+
<p class="mt-0.5 flex items-start gap-1">
4444
<img class="inline" src="./item/apple.png" />
4545
<span class="count-label">0</span>
4646
</p>
47-
<p class="mt-0.5 flex items-start gap-0.5">
47+
<p class="mt-0.5 flex items-start gap-1">
4848
<img class="inline" src="./item/green-apple.png" />
4949
<span class="green-apple-count-label">0</span>
5050
</p>
@@ -60,16 +60,13 @@
6060
class="text-neutral-500 relative text-xs flex items-center justify-between w-full max-w-[450px] font-8bit"
6161
>
6262
<div>
63-
<span class="px-0.5"
64-
>FPS <span class="js-fps-monitor">-</span>(<span class="js-v-monitor"
65-
>-</span>)</span>
66-
<span class="px-0.5">ACTORS
67-
<span class="js-actors-counter">-</span>
63+
<span>FPS <span class="js-fps-monitor"></span>/<span
64+
class="js-v-monitor"
65+
></span>
6866
</span>
69-
<span class="px-0.5">ITEMS
70-
<span class="js-items-counter">-</span>
71-
</span>
72-
<span>BUILD DATE BUILD_DATE</span>
67+
<span>ACTORS <span class="js-actors-counter"></span></span>
68+
<span>ITEMS <span class="js-items-counter"></span></span>
69+
<span>VERSION BUILD_DATE</span>
7370
</div>
7471
<span class="js-loading-indicator hidden">
7572
<svg
@@ -86,14 +83,14 @@
8683
</span>
8784
</div>
8885
<div
89-
class="w-full text-center font-8bit text-neutral-500 text-sm fixed bottom-5 sm:hidden"
86+
class="w-full text-center font-8bit text-neutral-500 text-xs fixed bottom-5 sm:hidden"
9087
>
91-
swipe and hold to move
88+
SWIPE AND HOLD TO MOVE
9289
</div>
9390
<div
94-
class="pl-1 font-8bit text-neutral-500 text-sm hidden sm:block"
91+
class="font-8bit text-neutral-500 text-xs hidden sm:block"
9592
>
96-
use arrow keys to move
93+
USE ARROW KEYS TO MOVE
9794
</div>
9895
</body>
9996
<script type="module" src="./main.js"></script>

0 commit comments

Comments
 (0)