Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
62d3e25
Merge pull request #2 from lajbel/order-stuff
Leorrut Nov 27, 2024
ce970dc
feat: add better coloring, text rendering and stuff
lajbel Nov 30, 2024
b422be6
chore: some adjusutments
lajbel Dec 5, 2024
0f08286
Merge pull request #3 from lajbel/refactors
Leorrut Dec 5, 2024
a3ac960
chore: no new line with errors
lajbel Dec 7, 2024
b1d3366
feat: update resizing, responsive, positions and fix writing
lajbel Dec 9, 2024
6b380fd
chore: change dialogs parsing
lajbel Dec 12, 2024
a9ee508
chore: some stuff
lajbel Dec 14, 2024
4456c2e
Merge pull request #4 from lajbel/refactors
Leorrut Dec 16, 2024
62244f2
Fix bugs in text writing and line jump
lajbel Dec 18, 2024
43b9bcd
Merge pull request #5 from lajbel/fix-text-writing
Leorrut Dec 18, 2024
84d091c
Content update for release
Leorrut Apr 29, 2025
800ad14
Add style and mobile resolution
Leorrut May 5, 2025
412ea6f
Case change in the errokey
Leorrut May 5, 2025
52bf26c
adding subdomain support
conanbatt May 7, 2025
8f9a940
Merge pull request #10 from silver-dev-org/gabriel/subdomain
conanbatt May 7, 2025
cc0973f
update readme
conanbatt May 8, 2025
31d458b
fix cookie domain
nicopujia May 6, 2025
567b7cb
add best level to cookie
nicopujia May 6, 2025
8001e43
remove incorrect domain in cookie
nicopujia May 12, 2025
79e4ff6
Merge pull request #11 from nicopujia/main
conanbatt May 12, 2025
e9fd20f
Update game
Leorrut May 14, 2025
347b11d
Update README.md
Leorrut May 14, 2025
fb1368a
Update selection text
Leorrut May 14, 2025
3f7b531
Improve text input and language selection
Leorrut May 22, 2025
d0d52c2
Merge pull request #12 from silver-dev-org/post-release-improvement
conanbatt May 29, 2025
e0a2e25
fix a Python code sample
Jun 8, 2025
fc5b326
Merge pull request #13 from jotarios/fix/python-samples
conanbatt Jun 11, 2025
6aeabc2
add react challenges
nicopujia Jun 12, 2025
e493d37
Merge pull request #14 from nicopujia/react-challenges
Leorrut Jun 19, 2025
5801476
fix index in menu when autocompleting
manuel-soria Oct 15, 2025
94a2967
Merge pull request #16 from manuel-soria/main
conanbatt Oct 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Contributing to WPM
add new challenges
locate **CodeBlocks.json** in data folder and add the block with the following format example considering spaces and line breaks **\n**

<pre>"id": 1,
"title": "Hello World",
"language": "js",
"blocks": [
"console.log(\"Hello, World!\");\n"
] </pre>

update build
open command console in game folder and type npm run build
this will be located in the dist\assets inside game folder, rename to game and replace the existing version inside website\public\game
2 changes: 1 addition & 1 deletion game/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!doctype html>
<html>
<head>
<title>mygame</title>
<title>WPM</title>
<link rel="stylesheet" href="/style.css" />
</head>

Expand Down
13 changes: 8 additions & 5 deletions game/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions game/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"fmt": "prettier --write ."
},
"dependencies": {
"kaplay": "^3001.0.2"
"kaplay": "^4000.0.0-alpha.17"
},
"devDependencies": {
"prettier": "^3.4.1",
"vite": "^5.4.11"
}
},
"packageManager": "pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1"
}
Binary file added game/public/fonts/jetbrains.ttf
Binary file not shown.
Binary file added game/public/fonts/thaleahFat.ttf
Binary file not shown.
Binary file added game/public/sounds/code_sound.mp3
Binary file not shown.
Binary file added game/public/sounds/endgame.mp3
Binary file not shown.
Binary file added game/public/sounds/videogame.mp3
Binary file not shown.
Binary file added game/public/sounds/wrong typing.mp3
Binary file not shown.
Binary file added game/public/sprites/BG_AWPM_IN_GAME.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/BG_TIME_IN_GAME.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/BG_WPM_IN_GAME.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/SilverDev_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/WPM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/arrow_yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified game/public/sprites/bg2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/bg4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/icon_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/icon_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/icon_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/icon_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/icon_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/muteOFF.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/public/sprites/muteON.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 28 additions & 36 deletions game/public/style.css
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
canvas {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 10;
}

:root {
--bg: #0a0a1b;
}

body {
--bg: hsl(0, 3.60%, 11.00%);
--gray1: #0a080a;
--gray2: #110b11;
}

body {
margin: 0;
background: var(--bg);
background-image: linear-gradient(
90deg,
rgba(35, 9, 30, 0.8) 2px,
transparent 1px
),
linear-gradient(0deg, rgba(9, 35, 50, 0.8) 2px, transparent 1px);
background-size: 30px 30px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
overflow: hidden;
}

.editor {
background: rgba(10, 10, 27, 0.8);
width: 1280px;
height: 640px;
border: 4px solid var(--neon2);
box-shadow: 0 0 10px var(--neon2);
display: flex;
flex-direction: column;
background: var(--bg);
position: relative;
}
}

body::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background:
linear-gradient(45deg, var(--gray1) 25%, transparent 25%),
linear-gradient(-45deg, var(--gray1) 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, var(--gray1) 75%),
linear-gradient(-45deg, transparent 75%, var(--gray1) 75%),
rgba(0, 0, 0, 0.81);
background-size: 15px 15px, 15px 15px, 15px 15px, 15px 15px, cover;
background-position: 0 0, 0 7.5px, 7.5px -7.5px, -7.5px 0, center;
background-blend-mode: multiply;
backdrop-filter: blur(10px);
z-index: -1;
}
20 changes: 12 additions & 8 deletions game/src/assets.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// @ts-check

import { k } from "./kaplay.js";

k.loadFont("monogram", "/fonts/monogram.ttf", {
outline: 4,
filter: "linear",
k.loadFont("jetbrains", "/fonts/jetbrains.ttf", {
outline: {
width: 6,
color: k.rgb(8, 8, 8)
},
});

k.loadSprite("bgpng", "/sprites/bgpng.png");
k.loadSprite("bg2", "/sprites/bg2.png");
k.loadSprite("bg4", "/sprites/bg4.png");
k.loadSprite("bg2", "/sprites/bg2.png");
k.loadSound("code_sound", "/sounds/code_sound.mp3");
k.loadSound("wrong_typing", "/sounds/wrong typing.mp3");
k.loadSprite("muteON", "/sprites/muteON.png");
k.loadSprite("muteOff", "/sprites/muteOFF.png");
k.loadSprite("WPM", "/sprites/WPM.png");
32 changes: 32 additions & 0 deletions game/src/components/resizablePos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @typedef {import("kaplay").Vec2} Vec2
* @typedef {import("kaplay").GameObj} GameObj
* @typedef {import("kaplay").PosComp} PosComp
*/

import { gameState } from "../constants.js";

/**
* Set the position on resize
*
* @param {() => Vec2} sizeFunc
*/
export const resizablePos = (sizeFunc) => ({
id: "resizablePos",
sizeFunc,
add() {
gameState.resizableObjects.push(this);
this.pos = this.sizeFunc();
},
/**
* @type { GameObj<PosComp> } this
*/
updatePos() {
// this.pos = this.sizeFunc();
},
destroy() {
gameState.resizableObjects = gameState.resizableObjects.filter(
(obj) => obj !== this,
);
},
});
29 changes: 29 additions & 0 deletions game/src/components/resizableRect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @typedef {import("kaplay").Vec2} Vec2
* @typedef {import("kaplay").GameObj} GameObj
* @typedef {import("kaplay").RectComp} RectComp
*/

import { gameState } from "../constants.js";
import { k } from "../kaplay.js";

/**
* Set the rect on resize
*
* @param {() => Vec2} resizeFunc
*/
export const resizableRect = (resizeFunc) => ({
id: "resizableRect",
resizeFunc,
add() {
// this.use(k.rect(this.resizeFunc().x, this.resizeFunc().y));
},
updateRectSize() {
// this.use(k.rect(this.resizeFunc().x, this.resizeFunc().y));
},
destroy() {
gameState.resizableObjects = gameState.resizableObjects.filter(
(obj) => obj !== this,
);
},
});
43 changes: 34 additions & 9 deletions game/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
// @ts-check

import dialogs from "./data/dialog.json";

export const goalBlocks = 2;
export const maxtime = 500;
export const maxMistakes = 2;
export const lineHeight = 24;
export const charSpacing = 10;
export const startmoveline = 1;
import dialogs from "./data/CodeBlocks.json";
export const EASY_RIVAL_SPEED = 0.35;
export const HARD_RIVAL_SPEED = 0.18;
export const MAX_TIME = 60;
export const goalBlocks = 5;
export const maxMistakes = 1;
export const lineHeight = 28;
export const startmoveline = 3;
export const marginvisiblebox = 1;
export const jsonData = dialogs;
export const dialogsData = dialogs;
export const ICON_START_Y = 0.15;
export const TEXT_START_Y = 0.15;
export const SPACING = 0.05;
export const MAX_BLOCKS = 5;
/**
* @type {number}
*/
// reduce for a jump line after x lines
export const JUMP_AFTER = 40;

/**
* Object for manage different states and configurations in the game
*/
export const gameState = {
/**
* Allocated resizable objects for update on resize
*
* @type {import("kaplay").GameObj[]}
*/
resizableObjects: [],
/**
* Time left
*/
timeLeft: 0,
};
Loading