From 6412ba2a628096274a837fa238f721091f414167 Mon Sep 17 00:00:00 2001 From: Jens Date: Sat, 21 Feb 2026 00:19:32 +0100 Subject: [PATCH] some stuff --- src/main.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/main.ts b/src/main.ts index 4a014fc..bd8d6f7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -130,6 +130,46 @@ scene("game", (scravatar: string) => { createCards(); const player = createPlayer(scravatar); + onUpdate(() => { + setCamPos(lerp(getCamPos(), player.pos, 0.1)); + }); + + const button = add([ + pos(10, height() - 50), + rect(120, 40), + outline(3, BLACK), + color("mediumspringgreen"), + area(), + layer("ui"), + fixed(), + "button", + ]); + + button.add([ + pos(60, 20), + anchor("center"), + color(BLACK), + text("Countdown", { font: "happy", size: 14 }), + ]); + + button.onHover(() => { + button.color = button.color.darken(40); + setCursor("pointer"); + }); + + button.onHoverEnd(() => { + button.color = button.color.lighten(40); + setCursor("default"); + }); + + onClick("button", () => { + addKaboom(mousePos()); + }); + + button.onClick(() => { + addKaboom(mousePos()); + }); + onKeyDown(["w", "up"], () => { player.moveBy(0, -SPEED); });