diff --git a/build/assets/index.html b/build/assets/index.html
index 4606300..d23bcc3 100644
--- a/build/assets/index.html
+++ b/build/assets/index.html
@@ -13,19 +13,6 @@
overflow: hidden;
font-family: sans-serif;
}
-
- #controls {
- position: fixed;
- width: calc(var(--slot-size) * 9);
- height: var(--slot-size);
- border: 1px solid gray;
- background: white;
- bottom: 10px;
- left: 0;
- right: 0;
- display: flex;
- margin: auto;
- }
$ICON$
diff --git a/build/build.ts b/build/build.ts
index 85a51fc..6303b59 100644
--- a/build/build.ts
+++ b/build/build.ts
@@ -6,7 +6,7 @@ import { buildHTML } from "./html";
import select from '@inquirer/select';
import { isGame, getGames } from './isGame';
-const outDir = path.resolve(import.meta.dir, '..', '..', 'dist');
+const outDir = path.resolve(import.meta.dir, '..', 'dist');
await fs.mkdir(outDir, { recursive: true });
let game = process.argv[2];
diff --git a/package.json b/package.json
index 85a57b0..4b73220 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"start": "bun --hot build/server.ts",
- "build": "bun build/build.ts"
+ "bake": "bun build/build.ts"
},
"dependencies": {
"@inquirer/select": "2.3.10",
diff --git a/src/games/binario/assets/ui.module.css b/src/games/binario/assets/ui.module.css
index 08ae893..a02bb98 100644
--- a/src/games/binario/assets/ui.module.css
+++ b/src/games/binario/assets/ui.module.css
@@ -47,4 +47,17 @@ body {
top: 5px;
right: 5px;
text-shadow: rgb(255, 255, 255) 1px 0px 0px, rgb(255, 255, 255) 0.540302px 0.841471px 0px, rgb(255, 255, 255) -0.416147px 0.909297px 0px, rgb(255, 255, 255) -0.989992px 0.14112px 0px, rgb(255, 255, 255) -0.653644px -0.756802px 0px, rgb(255, 255, 255) 0.283662px -0.958924px 0px, rgb(255, 255, 255) 0.96017px -0.279415px 0px;
+}
+
+.controls {
+ position: fixed;
+ width: calc(var(--slot-size) * 9);
+ height: var(--slot-size);
+ border: 1px solid gray;
+ background: white;
+ bottom: 10px;
+ left: 0;
+ right: 0;
+ display: flex;
+ margin: auto;
}
\ No newline at end of file
diff --git a/src/games/binario/ui.tsx b/src/games/binario/ui.tsx
index 15b7924..6341cc6 100644
--- a/src/games/binario/ui.tsx
+++ b/src/games/binario/ui.tsx
@@ -70,7 +70,7 @@ export default class UI {
constructor() {
this.root = document.createElement('div');
- this.root.id = 'controls';
+ this.root.className = styles.controls;
document.body.appendChild(this.root);
this.render();
diff --git a/src/games/olc-run-2024/assets/wrong.ogg b/src/games/olc-run-2024/assets/wrong.ogg
new file mode 100644
index 0000000..1f96f48
Binary files /dev/null and b/src/games/olc-run-2024/assets/wrong.ogg differ
diff --git a/src/games/olc-run-2024/index.tsx b/src/games/olc-run-2024/index.tsx
index bb53342..e4ce9b2 100644
--- a/src/games/olc-run-2024/index.tsx
+++ b/src/games/olc-run-2024/index.tsx
@@ -4,6 +4,7 @@ import { choice, delay, randInt, range } from "@common/utils";
import figuresImage from './assets/figures.png';
import placeSound from './assets/place.ogg';
import fillSound from './assets/fill.ogg';
+import wrongSound from './assets/wrong.ogg';
let display: BrickDisplay;
const field: BrickDisplayImage = {
@@ -19,6 +20,7 @@ let nextFigure: BrickDisplayImage = generateFigure();
let currentFigureX = 4;
let currentFigureY = 14;
let currentFigureBlink: boolean;
+let frame: number = 0;
const rowsToClear = new Set();
const colsToClear = new Set();
@@ -103,7 +105,12 @@ function tryToPlace() {
if (!canPlaceAnywhere(currentFigure)) {
display.gameOver = true;
+ wrongSound.currentTime = 0;
+ wrongSound.play();
}
+ } else {
+ wrongSound.currentTime = 0;
+ wrongSound.play();
}
}
@@ -143,6 +150,7 @@ function reset() {
currentFigureY = 14;
field.image = [];
display.score = 0;
+ display.gameOver = false;
}
function onKeyDown(e: KeyboardEvent) {
@@ -172,10 +180,16 @@ function onKeyDown(e: KeyboardEvent) {
currentFigure = BrickDisplay.rotateSprite(currentFigure, 90);
}
}
+ e.stopPropagation();
+ e.preventDefault();
+ return false;
}
async function loop() {
- currentFigureBlink = !currentFigureBlink;
+ frame++;
+ if (frame % 6 === 0) {
+ currentFigureBlink = !currentFigureBlink;
+ }
if (rowsToClear.size > 0 || colsToClear.size > 0) {
display.score += Math.pow(rowsToClear.size + colsToClear.size, 2) * 100;