some stuff
This commit is contained in:
40
src/main.ts
40
src/main.ts
@@ -130,6 +130,46 @@ scene("game", (scravatar: string) => {
|
|||||||
createCards();
|
createCards();
|
||||||
const player = createPlayer(scravatar);
|
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"], () => {
|
onKeyDown(["w", "up"], () => {
|
||||||
player.moveBy(0, -SPEED);
|
player.moveBy(0, -SPEED);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user