From 7424b8d4c40fd3a0008442efd784cf2990bdbb3a Mon Sep 17 00:00:00 2001 From: He4eT Date: Thu, 12 Jun 2025 03:57:57 +0200 Subject: [PATCH] game: interface draft --- game.js | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/game.js b/game.js index e943f2f..f2be50c 100644 --- a/game.js +++ b/game.js @@ -164,24 +164,26 @@ function gameScreen() { handleMorse() - drawInterface() drawArena() + drawInterface() drawFX() drawEnemies() drawPlayer() drawLetters() } -/* Interface */ - -function drawInterface() { - cls(0) -} - /* Arena */ function drawArena() { - map(0, 0, 30, 15) + cls(0) + map(0, 0, 30, 17) +} + +/* Interface */ + +function drawInterface() { + print('0', 145, 121, 4) + drawMorse(player.key.buffer, 102, 123, 15, 36) } /* Player */ @@ -501,13 +503,14 @@ function drawLetters() { y: screenPos.y + 9, } rect(hintPosition.x, hintPosition.y, hintWidth, 2, 3) - drawMorse(enemy.letter, hintPosition.x, hintPosition.y, 2, hintWidth) + const code = letterToMorse[enemy.letter] + drawMorse(code, hintPosition.x, hintPosition.y, 2, hintWidth) } }) } -function drawMorse(letter, x, y, color, width) { - const code = letterToMorse[letter].split('') +function drawMorse(codeString, x, y, color, width) { + const code = codeString.slice(-7).split('') const l = code.reduce((acc, c) => acc + (c === '-' ? 4 : 2), 0) let offset = x + 1 + (width ? width / 2 - Math.floor((l - 1) / 2) - 1 : 0) @@ -705,12 +708,29 @@ const BTN_Y = 7 // 016:0000000000000000000000000000000000000000000001110000012200000123 // 017:0000000000000000000000000000000000000000111111112222222233333333 // 018:0000000000000000000000000000000000000000111000002210000032100000 +// 019:0000000000000000000000000000000000000000000000000000000300000003 +// 020:0000000000000000000000000000000000000000000000003333333333333333 +// 021:0000000000000000000000000000000000000000000000003333333300000000 +// 022:0000000000000000000000000000000000000000000000003000055530000500 +// 023:0000000000000000000000000000000000000000000000005550000300500003 +// 024:0000000000000000000000000000000000000000000000003000000030000000 // 032:0000012300000123000001230000012300000123000001230000012300000123 // 033:2111111211111111111111111111111111111111111111111111111121111112 // 034:3210000032100000321000003210000032100000321000003210000032100000 +// 035:0000000000000000000000000000000000000000000000000000000000000003 +// 036:0000000000000000000000000000000000000000000000000000000033333333 +// 038:0000050000000000000000000000000000000000000000000000050030000500 +// 039:0050000000000000000000000000000000000000000000000050000000500003 +// 040:0000000000000000000000000000000000000000000000000000000030000000 // 048:0000012300000122000001110000000000000000000000000000000000000000 // 049:3333333322222222111111110000000000000000000000000000000000000000 // 050:3210000022100000111000000000000000000000000000000000000000000000 +// 051:0000000300000000000000000000000000000000000000000000000000000000 +// 052:3333333300000000000000000000000000000000000000000000000000000000 +// 053:3333333300000000000000000000000000000000000000000000000000000000 +// 054:3000055500000000000000000000000000000000000000000000000000000000 +// 055:5550000300000000000000000000000000000000000000000000000000000000 +// 056:3000000000000000000000000000000000000000000000000000000000000000 // 064:8800088080000080008880000088800000888000800000808800088000000000 // 065:8800088080000080000000000008000000000000800000808800088000000000 // 066:0000000008808800080008000008000008000800088088000000000000000000 @@ -733,7 +753,11 @@ const BTN_Y = 7 // 009:021212121212121212121212121212121212121212121212121212121222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 // 010:021212121212121212121212121212121212121212121212121212121222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 // 011:021212121212121212121212121212121212121212121212121212121222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -// 012:031313131313131313131313131313131313131313131313131313131323000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +// 012:021212121212121212121212121212121212121212121212121212121222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +// 013:031313131313131313131313131313131313131313131313131313131323000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +// 014:314151515151515151515151610000000071515151515151515151514181000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +// 015:324200000000000000000000620000000072000000000000000000004282000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +// 016:334353535353535353535353630000000073535353535353535353534383000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 // //