summaryrefslogtreecommitdiff
path: root/test-client/main.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-18 21:04:11 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-23 19:21:22 +0200
commitf4bc78d9dffda792cde848e0ae8040a98959591b (patch)
tree271ff06cbda6955eb5e093f83a952b9cb7b3e2a6 /test-client/main.ts
parent48934ff63ee14d4759eda36512af87361dd915dd (diff)
downloadhurrycurry-f4bc78d9dffda792cde848e0ae8040a98959591b.tar
hurrycurry-f4bc78d9dffda792cde848e0ae8040a98959591b.tar.bz2
hurrycurry-f4bc78d9dffda792cde848e0ae8040a98959591b.tar.zst
passive works
Diffstat (limited to 'test-client/main.ts')
-rw-r--r--test-client/main.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/test-client/main.ts b/test-client/main.ts
index 4c755e55..bfd352b3 100644
--- a/test-client/main.ts
+++ b/test-client/main.ts
@@ -68,7 +68,8 @@ let scale = 0
function send(p: PacketS) { ws.send(JSON.stringify(p)) }
function packet(p: PacketC) {
- if (!["position", "set_active"].includes(p.type)) console.log(p);
+ if (!["position", "set_active"].includes(p.type))
+ console.log(p);
switch (p.type) {
case "init":
my_id = p.id
@@ -101,7 +102,7 @@ function packet(p: PacketC) {
case "put_item": {
const player = players.get(p.player)!
const tile = tiles.get(p.tile.toString())!
- tile.item = player.item;
+ tile.item = player.item
player.item = undefined
break;
}
@@ -277,10 +278,7 @@ function draw_ingame() {
}
for (const [_, tile] of tiles) {
- ctx.save()
- ctx.translate(tile.x, tile.y)
if (tile.item) draw_item(tile.item)
- ctx.restore()
}
draw_interact_target()
@@ -297,7 +295,7 @@ function draw_item(item: ItemData) {
}
if (item.progress !== null && item.progress !== undefined) {
ctx.fillStyle = "rgba(115, 230, 58, 0.66)"
- ctx.fillRect(0, 0, 1, item.progress)
+ ctx.fillRect(-0.5, -0.5, 1, item.progress)
}
ctx.restore()
}