diff --git a/Sprite-0002.aseprite b/Sprite-0002.aseprite deleted file mode 100644 index 93fd6ecdd02a30c2a3f0d3841aa8706cbc523340..0000000000000000000000000000000000000000 Binary files a/Sprite-0002.aseprite and /dev/null differ diff --git a/Sprite-0003.aseprite b/Sprite-0003.aseprite deleted file mode 100644 index b65de37d3b9d813d56ef935f98a6336788bdd8bd..0000000000000000000000000000000000000000 Binary files a/Sprite-0003.aseprite and /dev/null differ diff --git a/Sprite-0004.aseprite b/Sprite-0004.aseprite deleted file mode 100644 index 0e43844fc4a8e88e78d92f2405987ffeef5dba94..0000000000000000000000000000000000000000 Binary files a/Sprite-0004.aseprite and /dev/null differ diff --git a/Sprite-0005.aseprite b/Sprite-0005.aseprite deleted file mode 100644 index 5cb09cbc05f461edfa2ab95d399534edb62462c7..0000000000000000000000000000000000000000 Binary files a/Sprite-0005.aseprite and /dev/null differ diff --git a/Sprite-0006.aseprite b/Sprite-0006.aseprite deleted file mode 100644 index 2ef4231749dbc96b4de014745a931b1e2ed27292..0000000000000000000000000000000000000000 Binary files a/Sprite-0006.aseprite and /dev/null differ diff --git a/aimerthing.aseprite b/aimerthing.aseprite deleted file mode 100644 index d95566ff057d94048a55e57cc294124be4c7c5dc..0000000000000000000000000000000000000000 Binary files a/aimerthing.aseprite and /dev/null differ diff --git a/arrow.png b/arrow.png deleted file mode 100644 index af1a7bea4b90adc0fb999fb9062b34c88d7e87f3..0000000000000000000000000000000000000000 Binary files a/arrow.png and /dev/null differ diff --git a/bkg.aseprite b/bkg.aseprite deleted file mode 100644 index 563b90219f2f574817bd30001852452e4e3cb5c9..0000000000000000000000000000000000000000 Binary files a/bkg.aseprite and /dev/null differ diff --git a/bkg.png b/bkg.png deleted file mode 100644 index c340d9c47979438c06b19873b83a77ff70f4b1be..0000000000000000000000000000000000000000 Binary files a/bkg.png and /dev/null differ diff --git a/boringaptwalltopcorner.aseprite b/boringaptwalltopcorner.aseprite deleted file mode 100644 index ca73affbf65908e7f499131325e503b76c685b2c..0000000000000000000000000000000000000000 Binary files a/boringaptwalltopcorner.aseprite and /dev/null differ diff --git a/byemclogo.png b/byemclogo.png deleted file mode 100644 index 77c6c94bf87712c1e8102172e70401ae8cc8eee2..0000000000000000000000000000000000000000 Binary files a/byemclogo.png and /dev/null differ diff --git a/crazyabackground_a.aseprite b/crazyabackground_a.aseprite deleted file mode 100644 index 7d6bb68e7198b85f8eec01d573f37e60ea12b8dc..0000000000000000000000000000000000000000 Binary files a/crazyabackground_a.aseprite and /dev/null differ diff --git a/crazyabackground_a.png b/crazyabackground_a.png deleted file mode 100644 index fb947fdeb7958abfbc47fc4db70a62abcdaf7334..0000000000000000000000000000000000000000 Binary files a/crazyabackground_a.png and /dev/null differ diff --git a/crazyabackground_a_big.png b/crazyabackground_a_big.png deleted file mode 100644 index d7a709174d66dc7a88575cf3451f9614d1d69f1c..0000000000000000000000000000000000000000 Binary files a/crazyabackground_a_big.png and /dev/null differ diff --git a/cursor.aseprite b/cursor.aseprite deleted file mode 100644 index c770b6a9dc2399e64bd5520c1ebdc6207a4afee0..0000000000000000000000000000000000000000 Binary files a/cursor.aseprite and /dev/null differ diff --git a/favicon.aseprite b/favicon.aseprite deleted file mode 100644 index 2d148083edd8d75b94c32f6b338c0d85d4b51266..0000000000000000000000000000000000000000 Binary files a/favicon.aseprite and /dev/null differ diff --git a/flor.png b/flor.png deleted file mode 100644 index 43994096e654327fd5069110a1a5ebae7b11e219..0000000000000000000000000000000000000000 Binary files a/flor.png and /dev/null differ diff --git a/game.js b/game.js index b26a15c4403a6c295f0af6df0b952e884949e450..0bdc46f0ea9184554843952f26c95ba429080129 100644 --- a/game.js +++ b/game.js @@ -1,16 +1,14 @@ -/* +/* For js13k 2022 Theme: death */ // CONFIG - -const fontStack = '"Comic Sans MS"'; let id = 0; const pi = Math.PI; -let o = {showFPS:true} -let pause = 0 -var gPar = (key) => { +let pause = 0; +let lPrefix = "bye_dbh_" // this is for JS13K's shared localStorage +const gPar = (key) => { // Address of the current window let address = window.location.search @@ -21,6 +19,33 @@ var gPar = (key) => { // Returning the respected value associated // with the provided key return parameterList.get(key) +}; + +let getStore = (o) => { + return localStorage.getItem(o); +} +let setStore = (o, v, ops={}) => { + if (ops.c) { // compression + v = lzs.compress(v); + } + localStorage.setItem(`${lPrefix}${o}`, `${v}`); +} +let o = { +} + +for (let i of Object.keys(localStorage)) { + console.log(i) + if (i.startsWith(`${lPrefix}o_`)) { + switch(getStore(i)) { + case "true": + o[i.slice(10)] = 1 + break; + case "false": + o[i.slice(10)] = 0 + break; + } + break; + } } const customLv = gPar("lv"); @@ -53,7 +78,7 @@ class Canvas { this.mousePos.x = ((evt.clientX - rect.left) * scaleX) + this.camera.x; this.mousePos.y = ((evt.clientY - rect.top) * scaleY) + this.camera.y; - + return { x: (evt.clientX - rect.left) * scaleX, // scale mouse coordinates after they have y: (evt.clientY - rect.top) * scaleY // been adjusted to be relative to element @@ -85,7 +110,7 @@ class Canvas { this.ctx.restore(); // console.log(`${x}, ${y}, ${w}, ${h}, ${cropX}, ${cropY}, ${cropW}, ${cropH}`); } - + drawImage(img, x, y, w, h, direction=0) { // alias for drawImg this.drawImg(img, x, y, w, h, direction); @@ -110,14 +135,14 @@ class Canvas { string = string.toUpperCase(); let chars = string.split(""); // console.log(chars); - + let charWidth = 7 let charOff = 0; // check if there's an odd number of chars if (chars.length % 2 == 1) { charOff = 1 } - let strLength = (chars.length * charWidth - charOff) * scalex; + let strLength = (chars.length * charWidth - charOff) * scalex; let charHeight = 7 let strHeight = (charHeight * scaley); @@ -126,10 +151,6 @@ class Canvas { } switch(align) { - case "start": - case "left": - x = x; - break; case "center": case "middle": x = x - strLength/2; @@ -140,9 +161,6 @@ class Canvas { break; } switch(vAliign) { - case "top": - y = y; - break; case "middle": case "center": y = y - strHeight/2; @@ -152,13 +170,13 @@ class Canvas { break; } - + let charI = 0; let nextOffset = (7 * scalex); let lastWasFull = false; - + for (let char of chars) { - + this.ctx.fillStyle = color; let row = 0; let col = 0; @@ -169,7 +187,7 @@ class Canvas { offset -= (0.5 * scalex); lastWasFull = false; } - + if(ops.shortFullStop) { if(char == ".") { lastWasFull = true; @@ -306,8 +324,8 @@ class Room { } // INIT CANVAS -var fI = fntINDEX; // in letters.js -var c = new Canvas('gameCanvas'); +let fI = fntINDEX; // in letters.js +let c = new Canvas('gameCanvas'); // check if the canvas is supported if(!c.ctx) { alert("Your browser does not support the canvas element"); @@ -335,7 +353,7 @@ let dPM = _=>{ c.dT("Death By Hamster", c.w / 2, c.h / 2 - 40, 2, 2, "white", "middle"); // Load images -var images = { +let images = { "mouse": { "ingame": "./aimerthing.png", "cursor": "./cursor.png" @@ -353,19 +371,19 @@ var images = { } }; -var loader = new Room("loader"); -var loadingText = "Loading..."; -var loadingError = 0; +let loader = new Room("loader"); +let loadingText = "Loading..."; +let loadingError = 0; loader.drawGUI = () => { c.dT(loadingText, c.w / 2, c.h / 2, 2, 2, "white", "middle"); if (loadingError) { c.dT(loadingErrorText, c.w / 2, c.h / 2 + 20, 1, 1, "red", "middle"); } } -var rooms = []; +let rooms = []; -var loadedImages = 0; -var totalImages = 0; +let loadedImages = 0; +let totalImages = 0; // count the total number of images to load for (let key in images) { @@ -380,11 +398,11 @@ loadingText = `Loading images (${loadedImages} / ${totalImages})` // after all images are loaded, and no errors occured, start the game -for (var key in images) { - for (var subkey in images[key]) { - +for (let key in images) { + for (let subkey in images[key]) { + // attempt to load the image - var IMG = new Image(); + let IMG = new Image(); IMG.addEventListener('load', () => { loadedImages++; loadingText = `Loading images (${loadedImages} / ${totalImages})` @@ -403,22 +421,17 @@ for (var key in images) { // add the image to the images object images[key][subkey] = IMG; - + // draw the loading text by drawing a rectangle over the previous text, and drawing the new text loadingText = `Loading images (${loadedImages} / ${totalImages})` - + } } let levels = [ - { - name: "Tutorial", - data: "NrCMBoIJgXXNLgMx2AVkQFlRXqrgAMy+R4s8BxoqmZhqGED8GVjyRHdL64AbF1bgMvDAHYhwQQA4p0EvAhJFCOiiUDVESRoSSK+yDi01NbE4M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ep+F2RPEeh29tyCkORtNClAcGKgbK0kAgUcgPLEib5KftUGgRxTTo4eH4kCB4bjZuLFItDidwhclejtyr4KQBdR1dhybo+Z1iEdqBkZkgqG2ihN8v7tyHDfHoMolgIW3iiAtNmGUA8PksngctibBgt8jgQA" ] hamsterRef = { @@ -449,7 +462,7 @@ hamsterRef = { } } -var levelRef = { +let levelRef = { "file": images.level.tileset, "default": { "x": 0, @@ -532,11 +545,11 @@ for (let tile of levelRef.tiles) { } console.debug(images) -var targFPS = 60; -var frame = 0; +let targFPS = 60; +let frame = 0; -var menu = new Room("menu"); +let menu = new Room("menu"); menu.s = 0 menu.o = [ @@ -613,12 +626,13 @@ menu.keyDown = (key) => { } } -var gameRoom = new Room("Game"); +let gameRoom = new Room("Game"); let lvlS = new Room("Level Select") lvlS.s = 0 lvlS.o = levels gameRoom.humans = 0 -var player = new Entity("Player", 0,0); +gameRoom.li = 0 +let player = new Entity("Player", 0,0); player.speed = 0; player.maxSpeed = 20; player.direction = 0; @@ -629,6 +643,7 @@ player.y = 0; player.w = player.crop.w*2; player.h = player.crop.h*2; gameRoom.o = [{t:"Next Level",a:_=>{lvlS.s += 1; lvlS.keyDown("Space"); gameRoom.tutorial=0}}, {t:"Level Select",a:_=>{setRoom(4)}}, {t:"Menu", a:_=>{setRoom(1)}}] + gameRoom.s = 0 gameRoom.pseo = [{t:"Back to Menu", a:_=>{setRoom(1)}},{t:"Level Select",a:_=>{setRoom(4)}}] gameRoom.pses = 0 @@ -641,10 +656,10 @@ player.step = _=> { // check that the player won't go into a wall on the next step, and if so, stop. player.checkpoints = []; for (let i = 0; i < 9; i++) { - + let carCx = player.x + player.w/2; let carCy = player.y + player.h/2; - + let pointOx = 0; let pointOy = 0; switch (i) { @@ -719,7 +734,7 @@ player.draw = _=> { let carCx = player.x + player.w/2; let carCy = player.y + player.h/2; - + // get gunx and guny by moving backwards (gunOx and gunOy) from the center of the car in this.direction let gunx = carCx - gunOx * Math.cos(player.direction * pi / 180) - gunOy * Math.sin(player.direction * pi / 180); let guny = carCy - gunOx * Math.sin(player.direction * pi / 180) + gunOy * Math.cos(player.direction * pi / 180); @@ -742,7 +757,7 @@ player.draw = _=> { } -} +} player.shoot = () => { // shoot a bullet @@ -751,7 +766,7 @@ player.shoot = () => { bullet.direction = player.aim; bullet.w = 2; bullet.h = 2; - + bullet.step = () => { // for each step, check if it's path intersects with any other entity for (let i = 0; i < cRoom.objects.length; i++) { @@ -822,6 +837,8 @@ gameRoom.keyDown = (key) => { for (let tile of gameRoom.level) { if (levelRef.tiles[tile[0]].type == "vent" && tile[1] == x && tile[2] == y) { for (let tile of gameRoom.level) if (levelRef.tiles[tile[0]].type == "vent" && !(tile[1] == x) && !(tile[2] == y)) { + console.log (x,y) + console.log(tile[1], tile[2]) player.x = tile[1]*64; player.y = tile[2]*64+16; player.speed = 0; @@ -922,10 +939,15 @@ gameRoom.checkwall = (tx,ty) => { } gameRoom.start = () =>{ + if (customLv) { gameRoom.level = customLv } - gameRoom.level = JSON.parse(lzs.decompressFromEncodedURIComponent(gameRoom.level)) + + if (gameRoom.li) { + gameRoom.level = JSON.parse(lzs.decompressFromEncodedURIComponent(levels[gameRoom.li - 1])) + } + gameRoom.finish = 0; gameRoom.objects = []; @@ -1001,6 +1023,9 @@ gameRoom.start = () =>{ } gameRoom.step = _=> { + if (lvlS.s+1 >= lvlS.o.length) { + gameRoom.o[0] = {t:"you killed them all!", a:_=>{alert("well done!!!")}} + } if (!pause&&!gameRoom.finish) { if (gameRoom.humans <= 0){ gameRoom.tutorial = 0; @@ -1194,7 +1219,7 @@ lvlS.keyDown = (key) => { } } if (key == "Space" || key == "Enter") { - gameRoom.level = lvlS.o[lvlS.s].data; + gameRoom.li = lvlS.s+1; if (lvlS.s === 0){ gameRoom.tutorial = 1; } @@ -1206,12 +1231,12 @@ lvlS.keyDown = (key) => { } } -var options = new Room("Settings") +let options = new Room("Settings") options.s = 0 options.ops = o; options.o = [{ "t": "Show FPS", - "a": _=>{ o.showFPS = !o.showFPS; localStorage.setItem('dbh_showFPS', o.showFPS); }, + "a": _=>{ o.showFPS = !o.showFPS; setStore("o_showFPS", o.showFPS) }, "v": "showFPS" }, { "t": "Menu", @@ -1262,13 +1287,13 @@ rooms.push(gameRoom); rooms.push(editor); rooms.push(lvlS); rooms.push(options) -var roomI = !gPar("goto") ? 0 : gPar("goto"); +let roomI = !gPar("goto") ? 0 : gPar("goto"); -var cRoom = rooms[roomI]; +let cRoom = rooms[roomI]; -var keysPressed = {}; -var keysLastPressed = {}; +let keysPressed = {}; +let keysLastPressed = {}; document.addEventListener('keydown', (e) => { keysPressed[e.code] = true; @@ -1278,12 +1303,12 @@ document.addEventListener('keyup', (e) => { keysLastPressed[e.code] = false; } ); -var lastTime = 0; +let lastTime = 0; -var mse = {x: 0, y: 0}; -var lastClick = {x: 0, y: 0}; -var leftclicked = false; -var rightclicked = false +let mse = {x: 0, y: 0}; +let lastClick = {x: 0, y: 0}; +let leftclicked = false; +let rightclicked = false c.c.addEventListener('mousemove', (e) => { mse = c.getMousePos(e); @@ -1320,15 +1345,15 @@ window.onwheel = (e)=>{ } try { -cRoom.start(); + cRoom.start(); - var gameLoop = setInterval(() => { + setInterval(() => { c.tW = c.c.offsetWidth; c.tH = c.c.offsetHeight; c.scale = c.tW / c.w; frame++; c.fill(cRoom.background); - + for (let key in keysPressed) { if (keysPressed[key]) { if (!keysLastPressed[key]) { @@ -1343,18 +1368,15 @@ cRoom.start(); cRoom.click(lastClick.x, lastClick.y); leftclicked = 0; } - + cRoom.step(); cRoom.draw(); - cRoom.drawGUI(); - - /* BEDUG INFO */ + cRoom.drawGUI(); + if (o.showFPS){ c.dT(`FPS:${Math.round(1000 / (Date.now() - lastTime))}`, 0+c.camera.x, 0+c.camera.y, 1, 1, "#fafafa", "left", "top"); } - - switch (cRoom.name) { case "menu": case "Editor": @@ -1365,9 +1387,9 @@ cRoom.start(); break; } lastTime = Date.now(); - + } , 1000/targFPS); // 60 fps - + } catch (error) { c.fill("#1c1c1c"); c.dT("Death By Hamster", c.w / 2, c.h / 2 - 40, 2, 2, "white", "middle"); diff --git a/gun.aseprite b/gun.aseprite deleted file mode 100644 index e44ecd49fb980b4433cf9127689b9d2254901156..0000000000000000000000000000000000000000 Binary files a/gun.aseprite and /dev/null differ diff --git a/hamster.aseprite b/hamster.aseprite deleted file mode 100644 index 60740508b37dc1023ff0c9c38dbf2b14fda0c339..0000000000000000000000000000000000000000 Binary files a/hamster.aseprite and /dev/null differ diff --git a/hamsterx2.aseprite b/hamsterx2.aseprite deleted file mode 100644 index ac661480b21bbeedb42f3ef66ca228d5eee98e71..0000000000000000000000000000000000000000 Binary files a/hamsterx2.aseprite and /dev/null differ diff --git a/human.aseprite b/human.aseprite deleted file mode 100644 index 4b248e6d50e11cc31e02db5d5a91a78c38019268..0000000000000000000000000000000000000000 Binary files a/human.aseprite and /dev/null differ diff --git a/lettermaker.html b/lettermaker.html deleted file mode 100644 index 0b068d3d8a9c68884f3d28070fc72d1ca353288a..0000000000000000000000000000000000000000 --- a/lettermaker.html +++ /dev/null @@ -1,127 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>Font maker</title> - <style> - input[type="checkbox"] { - all: unset; - display: inline-block; - border: 1px solid #ccc; - width: 20px; - height: 20px; - - /* No padding */ - padding: 0; - margin: 0; - vertical-align: middle; - } - - input[type="checkbox"]:checked { - background-color: rgb(0, 0, 0); - } - - input[type="checkbox"]:focus { - outline: none; - } - </style> -</head> -<body> - - <div id="inputbox"> - <!-- 16x16 grid of checkboxes --> - </div> - - <pre id="output"> - - </pre> - - <canvas id="renderedOutput"> - Your browser doesn't support canvas. - </canvas> - - <script> - var drawing = document.getElementById("inputbox"); - var routput = document.getElementById("renderedOutput"); - var ctx = routput.getContext("2d"); - - chkNum = 0; - - for (var i = 0; i < 8; i++) { - for (var j = 0; j < 8; j++) { - var checkbox = document.createElement("input"); - chkNum++; - checkbox.type = "checkbox"; - checkbox.id = chkNum; - checkbox.addEventListener("change", function() { - updateOutput(); - }); - drawing.appendChild(checkbox); - } - drawing.appendChild(document.createElement("br")); - } - - var output = document.getElementById("output"); - var outputText = ""; - var listOfBoxes = []; - - var updateOutput = () => { - listOfBoxes = []; - // for each row of checkboxes, give it its own array in the listOfBoxes array - for (var i = 0; i < 8; i++) { - listOfBoxes.push([]); - for (var j = 0; j < 8; j++) { - var chk = document.getElementById(i * 8 + j + 1); - if (chk.checked) { - listOfBoxes[i].push(1); - } else { - listOfBoxes[i].push(0); - } - } - } - - // run through each item in the listOfBoxes array and remove leading zeros - for (var i = 0; i < listOfBoxes.length; i++) { - var row = listOfBoxes[i]; - // run through the array backwards - for (var j = row.length - 1; j >= 0; j--) { - // if it's a 0, remove it - if (row[j] == 0) { - row.splice(j, 1); - } else { - // if it's a 1, stop removing - break; - } - } - } - - // output the listOfBoxes array to the output textarea, row by row - outputText = "const fntCHAR = [\n"; - for (var i = 0; i < listOfBoxes.length; i++) { - outputText += " ["; - for (var j = 0; j < listOfBoxes[i].length; j++) { - if (listOfBoxes[i][j] == 1) { - outputText += "1"; - } else { - outputText += ""; - } - if (j != listOfBoxes[i].length - 1) { - outputText += ", "; - } - } - outputText += "],\n"; - } - outputText += "];\n"; - output.innerHTML = outputText; - - } - - updateOutput(); - - - </script> - -</body> -</html> \ No newline at end of file diff --git a/lettertester.html b/lettertester.html deleted file mode 100644 index 09d2336a70b299348ed594a243955cc551b86589..0000000000000000000000000000000000000000 --- a/lettertester.html +++ /dev/null @@ -1,390 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>Font tester</title> -</head> -<body> - <canvas id="cvs" width="1000"> - Your browser doesn't support canvas. - </canvas> - <input type="text" id="txtinput"> - <script> - // Inspired by https://github.com/PaulBGD/PixelFont - - -const fntA = [ - [, , 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], -]; - -const fntB = [ - [, 1, 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, 1, 1, 1], - -]; - -const fntC = [ - [, , 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1], - [, 1, 1], - [, 1, 1], - [, 1, 1, , , 1, 1], - [, , 1, 1, 1, 1] - -]; - -const fntD = [ - [, 1, 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, 1, 1, 1] - -]; - -const fntE = [ - - [, , 1, 1, 1, 1, 1], - [, 1, 1, 1, 1, 1, 1], - [, 1, 1], - [, 1, 1, 1, 1, 1], - [, 1, 1], - [, 1, 1, 1, 1, 1, 1], - [, , 1, 1, 1, 1, 1], - -]; - -const fntF = [ - - [, , 1, 1, 1, 1, 1], - [, 1, 1, 1, 1, 1, 1], - [, 1, 1], - [, 1, 1, 1, 1, 1], - [, 1, 1], - [, 1, 1], - [, 1, 1], - -]; - -const fntG = [ - [, , 1, 1, 1, 1, 1], - [, 1, 1, 1, 1, 1, 1], , - [, 1, 1], - [, 1, 1, , 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, 1, 1, 1, 1], - [, , 1, 1, 1, 1] - -]; - -const fntH = [ - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1,1,1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - -]; - -const fntI = [ - - [, 1, 1, 1, 1, 1, 1], - [, , , 1, 1], - [, , , 1, 1], - [, , , 1, 1], - [, , , 1, 1], - [, , , 1, 1], - [, 1, 1, 1, 1, 1, 1], -]; - -const fntJ = [ - - [, , 1, 1, 1, 1, 1], - [, , , , , 1, 1], - [, , , , , 1, 1], - [, , , , , 1, 1], - [, , , , , 1, 1], - [, 1, 1, , , 1, 1], - [, , 1, 1, 1, 1], - - ]; - - const fntK = [ - - [, 1, 1, , , 1], - [, 1, 1, , , 1], - [, 1, 1, , 1], - [, 1, 1, 1], - [, 1, 1, , 1], - [, 1, 1, , , 1], - [, 1, 1, , , 1], - - ]; - - const fntL = [ - - [, 1, 1], - [, 1, 1], - [, 1, 1], - [, 1, 1], - [, 1, 1], - [, 1, 1, 1, 1, 1, 1], - [, 1, 1, 1, 1, 1, 1], - - ]; - - const fntM = [ - - [, 1, 1, , , , 1], - [, 1, 1, 1, , 1, 1], - [, 1, 1, , 1, , 1], - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - - ]; - - const fntN = [ - - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - [, 1, 1, 1, , , 1], - [, 1, 1, 1, 1, , 1], - [, 1, 1, , 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , , 1], - - ]; - - const fntO = [ - - [, , 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, , 1, 1, 1, 1], - - ]; - - const fntP = [ - [, 1, 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, 1, 1, 1], - [, 1, 1], - [, 1, 1], - [, 1, 1], - - ]; - - const fntQ = [ - - [, , 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , 1, 1, 1], - [, 1, 1, , , 1, 1], - [, , 1, 1, 1, 1, , 1], - - ]; - - const fntR = [ - - [, 1, 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - - ]; - - const fntS = [ - - [, , 1, 1, 1, 1], - [, 1, 1, , , , 1], - [, 1, 1], - [, , 1, 1, 1, 1], - [, , , , , , 1], - [, 1, 1, , , , 1], - [, , 1, 1, 1, 1], - - ]; - - const fntT = [ - - [, 1, 1, 1, 1, 1, 1], - [, 1, 1, 1, 1, 1, 1], - [, , , 1, 1], - [, , , 1, 1], - [, , , 1, 1], - [, , , 1, 1], - [, , , 1, 1], - - ]; - - const fntU = [ - - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, 1, 1, 1, 1], - [, , 1, 1, 1, 1], - - ]; - - const fntV = [ - - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - [, , 1, 1, , 1], - [, , , 1, 1], - - ]; - - const fntW = [ - - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - [, 1, 1, , , , 1], - [, 1, 1, , 1, , 1], - [, 1, 1, , 1, , 1], - [, 1, 1, , 1, , 1], - [, , , 1, , 1], - - ]; - - const fntX = [ - - [, 1, , , , , 1], - [, 1, 1, , , 1, 1], - [, , 1, 1, 1, 1], - [, , , 1, 1], - [, , 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, , , , , 1], - - ]; - - const fntY = [ - - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, , 1, 1, 1, 1, 1], - [, , , , , 1, 1], - [, 1, 1, , , 1, 1], - [, , 1, 1, 1, 1], - - ]; - - const fntZ = [ - - [1, 1, 1, 1, 1, 1], - [, , , , , 1, 1], - [, , , , 1, 1], - [, , , 1, 1], - [, , 1, 1], - [, 1, 1], - [, 1, 1, 1, 1, 1, 1], , - - ]; - - const fntTalt = [ - - [, 1, 1, 1, 1, 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - [, 1, 1, , , 1, 1], - - ]; - - const fntINDEX = { - 'A': fntA, 'B': fntB, 'C': fntC, 'D': fntD, 'E': fntE, 'F': fntF, - 'G': fntG, 'H': fntH, 'I': fntI, 'J': fntJ, 'K': fntK, 'L': fntL, - 'M': fntM, 'N': fntN, 'O': fntO, 'P': fntP, 'Q': fntQ, 'R': fntR, - 'S': fntS, 'T': fntT, 'U': fntU, 'V': fntV, 'W': fntW, 'X': fntX, - 'Y': fntY, 'Z': fntZ, '1': fntTalt -} - - - </script> - <script> - - console.log(fntINDEX); - - var canvas = document.getElementById("cvs"); - var ctx = canvas.getContext("2d"); - var text = ""; - var txtinput = document.getElementById("txtinput"); - text = txtinput.value; - var letters = fntINDEX; - var size = 6; - - txtinput.addEventListener("keyup", function(event) { - var needed = []; - text = text.toUpperCase(); // because I only did uppercase letters - for (var i = 0; i < text.length; i++) { - var letter = letters[ text.charAt(i)]; - if (letter) { // because there's letters I didn't do - needed.push(letter); - } - } - - ctx.fillStyle = 'black'; - var currX = 0; - for (i = 0; i < needed.length; i++) { - letter = needed[i]; - var currY = 0; - var addX = 0; - for (var y = 0; y < letter.length; y++) { - var row = letter[y]; - for (var x = 0; x < row.length; x++) { - if (row[x]) { - ctx.fillRect(currX + x * size, currY, size, size); - } - } - addX = Math.max(addX, row.length * size); - currY += size; - } - currX += size + addX; - - needed.splice(i) - } - }); - - - </script> -</body> -</html> \ No newline at end of file diff --git a/logothing.aseprite b/logothing.aseprite deleted file mode 100644 index 0c66fb8255c05c564d53efac9e0c22f30bfc6378..0000000000000000000000000000000000000000 Binary files a/logothing.aseprite and /dev/null differ diff --git a/minify.py b/minify.py new file mode 100644 index 0000000000000000000000000000000000000000..9c7ad88d91e2373b378eee3e4a080d8904ddc6af --- /dev/null +++ b/minify.py @@ -0,0 +1,5 @@ +import os + +for ff in os.listdir(): + if (ff.endswith(".png")): + print(ff) diff --git a/nesex.aseprite b/nesex.aseprite deleted file mode 100644 index c9e606dbd06accd534cab43e4858a70f68f70d60..0000000000000000000000000000000000000000 Binary files a/nesex.aseprite and /dev/null differ diff --git a/t.aseprite b/t.aseprite deleted file mode 100644 index 49c5cac42282238b3105fdb4626a8c162e729241..0000000000000000000000000000000000000000 Binary files a/t.aseprite and /dev/null differ diff --git a/t.js b/t.js deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/testbanner.png b/testbanner.png deleted file mode 100644 index 1e8ca888d1fc8f2864e87d743943b57eb31fe1ec..0000000000000000000000000000000000000000 Binary files a/testbanner.png and /dev/null differ