Knight Climb: customization guide

Step by step, no programming needed. Version 1.0.0.

Contents

  1. Before you start
  2. Which file draws each part of the screen
  3. Change pictures and the hero
  4. Logo and page title
  5. Change texts
  6. Add or remove a language
  7. Edit levels
  8. Difficulty and feel
  9. Shop colors and prices
  10. Music and sounds
  11. Colors and fonts
  12. Internal names
  13. Publish your version

1. Before you start

  1. Make a copy of the whole folder (backup). If something goes wrong, copy the file back.
  2. Use a plain-text code editor, for example Visual Studio Code (free). Do not use Word.
  3. Edit the files in source/. To see the result, open a terminal in source/ and run npm run serve, then open http://localhost:5198/ (see the main guide, Development). Without Node.js you can edit the same files inside game/ and test them on your web host.
  4. After each change, reload the page with Ctrl+F5 (Cmd+Shift+R on a Mac).
  5. Free picture tools: Squoosh (squoosh.app, converts PNG/JPG to WebP), GIMP, Krita, Photopea. Free sound tools: Audacity.

2. Which file draws each part of the screen

A level123456
A level
  1. hearts: assets/heart.webp, heart0.webp; count: TUNE.hearts in src/config.js
  2. level name and number: texts in src/levels.js (names) and src/locales.js (level)
  3. coins: assets/coin.webp; style .cap in the style files
  4. pause button: assets/i-pause.webp; pause panel #m-pause in index.html
  5. height bar: assets/bell.webp (the bell) and k-head.webp; #bar in the style files
  6. rubies: assets/jade.webp; how many: letter j in the level text

Everything else inside the level (walls, hero, enemies, bosses, items, effects) is drawn on a canvas by src/view.js with the pictures of assets/. The screens and panels (title, map, shop, settings, win, lose) are HTML in index.html with the style files.

3. Change pictures and the hero

  1. All pictures are WebP files in assets/. Find the one you want (open it in the browser or the editor).
  2. Make your picture with the same size (width x height in pixels) and a transparent background where the original is transparent. Save it as WebP with the same file name and replace the old file.
  3. Reload the game. Nothing in the code needs to change.

The hero has one picture per pose: k-cheer.webp, k-climb1.webp, k-climb2.webp, k-climb3.webp, k-climb4.webp, k-cling2.webp, k-cut.webp, k-dashp.webp, k-dizzy.webp, k-fall.webp, k-fall2.webp, k-fly1.webp, k-fly2.webp, k-fly3.webp, k-head.webp, k-hurt.webp, k-idle.webp, k-joy.webp, k-leap.webp, k-peek.webp, k-rope.webp, k-slash.webp, k-wind.webp. Replace all of them to change the character; keep the feet at the same place in the picture, because the game aligns the poses by the empty space under the feet.

The cape is not painted on the poses. The shop color changes the two cloth strips of the cape (tail-<color>-a/b.webp), drawn behind the hero; the k-*.webp poses are never recolored (tintHero in src/art.js returns at once; the recolor code below it is kept for a hero with a painted cloth).

Backgrounds of the levels: bg1.webp … bg5.webp (one per world); walls: wall1.webp … wall5.webp; world maps: bg-map.webp, bg-map2.webp … bg-map5.webp; bosses: boss1.webp, boss2.webp, boss3.webp, bell-b1.webp, bell-b3.webp, dragon-b1.webp, dragon-b3.webp, shadow-b1.webp, shadow-b3.webp, oni-b1.webp, oni-b3.webp.

5. Change texts

  1. Open src/locales.js. The list K has the name of every text (play, level, paused…); below it, T has one list per language in the same order.
  2. To change "PLAY" in English, change the first text of the en list. Keep the quotes and the commas.
  3. {n} is replaced by a number (for example 'LEVEL {n}'): keep it.
  4. Level names (in English) are in src/levels.js; boss names are texts of src/locales.js.
  5. Run npm test: it checks that every language still has every text.

6. Add or remove a language

  1. In src/locales.js, the list LANGS has one line per language: code, name shown in the menu, flag (picture assets/flag-<flag>.webp).
  2. To add one: copy the en list in T, give it the new code, translate every text, add the line to LANGS and a flag picture.
  3. To remove one: delete its line in LANGS and its list in T; the test locales.test.mjs counts 14 languages, so change that number too.
  4. Arabic (ar) turns the page right to left automatically.

7. Edit levels

Open src/levels.js. The explanation at the top of the file is the legend. In short:

Fases do Knight Climb. Cada fase são 3 colunas de texto lidas DE BAIXO PARA CIMA (1 letra = 1 linha de 60 px):
  L / R (paredes):  # parede   B parede 1 recuo para dentro   C 2 recuos   . vão (sem parede)   ^ espinhos
                    d parede com boneco de treino   t parede com goblin (joga machadinhas)   a parede com cavaleiro negro (só a investida derruba)
                    x parede que desmorona 0,55 s depois do 1º toque   i parede de gelo (o herói escorrega para baixo)
  M (meio do poço): o moeda   c morcego que cruza   b fantasma (voa em oito)   l lanterna (checkpoint)   j rubi
O sino fica 2 linhas acima do topo. A ordem das linhas no arquivo é de baixo (início) para cima (fim).
  1. CHUNK has the pieces: three texts each (left wall, right wall, middle), read from bottom to top, one letter = one row of 60 pixels. Every piece starts and ends with two rows of wall on both sides, so pieces can follow each other in any order.
  2. World 1: the list PLAN has, for each level, its name and its pieces in order (~ before a name uses the mirrored piece). The 10th level of each world is the boss ('calm calm', '<boss>').
  3. Worlds 2 to 5: WORLD has the 10 names of each world, the new pieces (NEW) and the boss; the pieces of each level are drawn from a fixed seed, so a level is always the same. To hand-write a level, write it in PLAN instead.
  4. Run npm test. The robot plays every level; if one cannot be finished (or an item can only be taken by dying), the test names it. Then play it yourself: http://localhost:5198/?level=12.

8. Difficulty and feel

src/config.js has every number in one place, with a comment on each line:

After changing TUNE, run npm test: the robot checks the levels are still possible.

9. Shop colors and prices

SCARVES in src/art.js: each line is [id, main color, edge color, price in coins]. The first one is free and owned from the start. The shop picture of each color is assets/scarf-<id>.webp; a new id needs a new picture with that name. The cape itself is the two cloth strips drawn behind the hero from assets/tail-<id>-a.webp and tail-<id>-b.webp: a new color needs those two pictures too.

10. Music and sounds

11. Colors and fonts

12. Internal names

Code comments are in Portuguese. These short names appear in the code:

In the code In the game
hero the hero (the knight); events `hero-start`, `hero-lang`, `hero-prefs`; test object `window.__knight`
k-*.webp the hero poses (k is the prefix of the engine)
scarf, SCARVES the cape: the shop colors and the two cloth strips drawn behind the hero
jade rubies in the middle of the shaft (all of them = 1 star)
lantern checkpoint: after a fall the hero comes back at the last lit lantern
bell the goal at the top of a level; also the id of the world 2 boss (Dungeon Golem)
tengu, bell, dragon, shadow, oni boss ids: Ogre King, Dungeon Golem, Flying Wizard, Black Knight, Ice Dragon
crow bat
bat ghost
dummy training dummy
thrower, shuriken the goblin and its hatchets
armor black knight (only the dash knocks it out)
crum (x), ice (i), B / C, ^ cracked stones, ice wall, wall ledges, iron spikes (level letters)
endless the endless tower (best height in meters)
dash the dash (tap again in the air)

13. Publish your version

  1. In source/: npm test, then npm run build.
  2. Upload the contents of source/dist/ to your web host (replace the old files).
  3. If the old version still appears, see "Updates and browser cache" in the main guide.

Support: willian@polargames.com.br