diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-01 16:24:21 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-01 16:24:21 +0200 |
commit | cd41deaf64d5b5f4f6e2488396fbf29778c4f91c (patch) | |
tree | 70691e65bbefae8b48f2869c21daac2f6a5f0199 /test-client/main.ts | |
parent | 17024786036868b66a86caaf967a65d77dc2bd15 (diff) | |
download | hurrycurry-cd41deaf64d5b5f4f6e2488396fbf29778c4f91c.tar hurrycurry-cd41deaf64d5b5f4f6e2488396fbf29778c4f91c.tar.bz2 hurrycurry-cd41deaf64d5b5f4f6e2488396fbf29778c4f91c.tar.zst |
game ends with timer
Diffstat (limited to 'test-client/main.ts')
-rw-r--r-- | test-client/main.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test-client/main.ts b/test-client/main.ts index 38b9e730..aeca8084 100644 --- a/test-client/main.ts +++ b/test-client/main.ts @@ -99,6 +99,7 @@ export const items_removed = new Set<ItemData>() export let data: Gamedata = { item_names: [], tile_names: [], spawn: [0, 0], tile_collide: [], tile_interact: [] } +export let time_remaining: number | null = null export let global_message: MessageData | undefined = undefined let global_message_clear: number | undefined = undefined export let my_id: PlayerID = -1 @@ -204,6 +205,7 @@ function packet(p: PacketC) { demands_completed = p.demands_completed demands_failed = p.demands_failed points = p.points + time_remaining = p.time_remaining ?? null break; case "error": if (global_message_clear) clearTimeout(global_message_clear) @@ -288,6 +290,8 @@ function frame_update(dt: number) { const p = players.get(my_id) if (!p) return + if (time_remaining != null) time_remaining -= dt + const input = normalize({ x: (+keys_down.has(KEY_RIGHT) - +keys_down.has(KEY_LEFT)), y: (+keys_down.has(KEY_DOWN) - +keys_down.has(KEY_UP)) |