mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-21 12:36:15 -04:00
wip
This commit is contained in:
parent
722637f11f
commit
0759981a55
21 changed files with 3294 additions and 251 deletions
|
@ -2,7 +2,7 @@
|
||||||
# Credits
|
# Credits
|
||||||
|
|
||||||
I pulled many background patterns from https://pattern.monster/
|
I pulled many background patterns from https://pattern.monster/
|
||||||
They are displayed in [patterns.html](patterns.html) for easy inclusion.
|
They are displayed in [patterns.html](editor/patterns.html) for easy inclusion.
|
||||||
|
|
||||||
Some of the sound generating code was written by ChatGPT, and heavily
|
Some of the sound generating code was written by ChatGPT, and heavily
|
||||||
adapted to my usage over time.
|
adapted to my usage over time.
|
||||||
|
|
602
dist/editor.767b7f59.js
vendored
Normal file
602
dist/editor.767b7f59.js
vendored
Normal file
|
@ -0,0 +1,602 @@
|
||||||
|
// modules are defined as an array
|
||||||
|
// [ module function, map of requires ]
|
||||||
|
//
|
||||||
|
// map of requires is short require name -> numeric require
|
||||||
|
//
|
||||||
|
// anything defined in a previous bundle is accessed via the
|
||||||
|
// orig method which is the require for previous bundles
|
||||||
|
|
||||||
|
(function (modules, entry, mainEntry, parcelRequireName, globalName) {
|
||||||
|
/* eslint-disable no-undef */
|
||||||
|
var globalObject =
|
||||||
|
typeof globalThis !== 'undefined'
|
||||||
|
? globalThis
|
||||||
|
: typeof self !== 'undefined'
|
||||||
|
? self
|
||||||
|
: typeof window !== 'undefined'
|
||||||
|
? window
|
||||||
|
: typeof global !== 'undefined'
|
||||||
|
? global
|
||||||
|
: {};
|
||||||
|
/* eslint-enable no-undef */
|
||||||
|
|
||||||
|
// Save the require from previous bundle to this closure if any
|
||||||
|
var previousRequire =
|
||||||
|
typeof globalObject[parcelRequireName] === 'function' &&
|
||||||
|
globalObject[parcelRequireName];
|
||||||
|
|
||||||
|
var cache = previousRequire.cache || {};
|
||||||
|
// Do not use `require` to prevent Webpack from trying to bundle this call
|
||||||
|
var nodeRequire =
|
||||||
|
typeof module !== 'undefined' &&
|
||||||
|
typeof module.require === 'function' &&
|
||||||
|
module.require.bind(module);
|
||||||
|
|
||||||
|
function newRequire(name, jumped) {
|
||||||
|
if (!cache[name]) {
|
||||||
|
if (!modules[name]) {
|
||||||
|
// if we cannot find the module within our internal map or
|
||||||
|
// cache jump to the current global require ie. the last bundle
|
||||||
|
// that was added to the page.
|
||||||
|
var currentRequire =
|
||||||
|
typeof globalObject[parcelRequireName] === 'function' &&
|
||||||
|
globalObject[parcelRequireName];
|
||||||
|
if (!jumped && currentRequire) {
|
||||||
|
return currentRequire(name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are other bundles on this page the require from the
|
||||||
|
// previous one is saved to 'previousRequire'. Repeat this as
|
||||||
|
// many times as there are bundles until the module is found or
|
||||||
|
// we exhaust the require chain.
|
||||||
|
if (previousRequire) {
|
||||||
|
return previousRequire(name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try the node require function if it exists.
|
||||||
|
if (nodeRequire && typeof name === 'string') {
|
||||||
|
return nodeRequire(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
var err = new Error("Cannot find module '" + name + "'");
|
||||||
|
err.code = 'MODULE_NOT_FOUND';
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
localRequire.resolve = resolve;
|
||||||
|
localRequire.cache = {};
|
||||||
|
|
||||||
|
var module = (cache[name] = new newRequire.Module(name));
|
||||||
|
|
||||||
|
modules[name][0].call(
|
||||||
|
module.exports,
|
||||||
|
localRequire,
|
||||||
|
module,
|
||||||
|
module.exports,
|
||||||
|
globalObject
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache[name].exports;
|
||||||
|
|
||||||
|
function localRequire(x) {
|
||||||
|
var res = localRequire.resolve(x);
|
||||||
|
return res === false ? {} : newRequire(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolve(x) {
|
||||||
|
var id = modules[name][1][x];
|
||||||
|
return id != null ? id : x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Module(moduleName) {
|
||||||
|
this.id = moduleName;
|
||||||
|
this.bundle = newRequire;
|
||||||
|
this.exports = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
newRequire.isParcelRequire = true;
|
||||||
|
newRequire.Module = Module;
|
||||||
|
newRequire.modules = modules;
|
||||||
|
newRequire.cache = cache;
|
||||||
|
newRequire.parent = previousRequire;
|
||||||
|
newRequire.register = function (id, exports) {
|
||||||
|
modules[id] = [
|
||||||
|
function (require, module) {
|
||||||
|
module.exports = exports;
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.defineProperty(newRequire, 'root', {
|
||||||
|
get: function () {
|
||||||
|
return globalObject[parcelRequireName];
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
globalObject[parcelRequireName] = newRequire;
|
||||||
|
|
||||||
|
for (var i = 0; i < entry.length; i++) {
|
||||||
|
newRequire(entry[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainEntry) {
|
||||||
|
// Expose entry point to Node, AMD or browser globals
|
||||||
|
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||||
|
var mainExports = newRequire(mainEntry);
|
||||||
|
|
||||||
|
// CommonJS
|
||||||
|
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||||
|
module.exports = mainExports;
|
||||||
|
|
||||||
|
// RequireJS
|
||||||
|
} else if (typeof define === 'function' && define.amd) {
|
||||||
|
define(function () {
|
||||||
|
return mainExports;
|
||||||
|
});
|
||||||
|
|
||||||
|
// <script>
|
||||||
|
} else if (globalName) {
|
||||||
|
this[globalName] = mainExports;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})({"dOfEu":[function(require,module,exports,__globalThis) {
|
||||||
|
var global = arguments[3];
|
||||||
|
var HMR_HOST = null;
|
||||||
|
var HMR_PORT = null;
|
||||||
|
var HMR_SECURE = false;
|
||||||
|
var HMR_ENV_HASH = "d6ea1d42532a7575";
|
||||||
|
var HMR_USE_SSE = false;
|
||||||
|
module.bundle.HMR_BUNDLE_ID = "c9ef8121767b7f59";
|
||||||
|
"use strict";
|
||||||
|
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ /*::
|
||||||
|
import type {
|
||||||
|
HMRAsset,
|
||||||
|
HMRMessage,
|
||||||
|
} from '@parcel/reporter-dev-server/src/HMRServer.js';
|
||||||
|
interface ParcelRequire {
|
||||||
|
(string): mixed;
|
||||||
|
cache: {|[string]: ParcelModule|};
|
||||||
|
hotData: {|[string]: mixed|};
|
||||||
|
Module: any;
|
||||||
|
parent: ?ParcelRequire;
|
||||||
|
isParcelRequire: true;
|
||||||
|
modules: {|[string]: [Function, {|[string]: string|}]|};
|
||||||
|
HMR_BUNDLE_ID: string;
|
||||||
|
root: ParcelRequire;
|
||||||
|
}
|
||||||
|
interface ParcelModule {
|
||||||
|
hot: {|
|
||||||
|
data: mixed,
|
||||||
|
accept(cb: (Function) => void): void,
|
||||||
|
dispose(cb: (mixed) => void): void,
|
||||||
|
// accept(deps: Array<string> | string, cb: (Function) => void): void,
|
||||||
|
// decline(): void,
|
||||||
|
_acceptCallbacks: Array<(Function) => void>,
|
||||||
|
_disposeCallbacks: Array<(mixed) => void>,
|
||||||
|
|};
|
||||||
|
}
|
||||||
|
interface ExtensionContext {
|
||||||
|
runtime: {|
|
||||||
|
reload(): void,
|
||||||
|
getURL(url: string): string;
|
||||||
|
getManifest(): {manifest_version: number, ...};
|
||||||
|
|};
|
||||||
|
}
|
||||||
|
declare var module: {bundle: ParcelRequire, ...};
|
||||||
|
declare var HMR_HOST: string;
|
||||||
|
declare var HMR_PORT: string;
|
||||||
|
declare var HMR_ENV_HASH: string;
|
||||||
|
declare var HMR_SECURE: boolean;
|
||||||
|
declare var HMR_USE_SSE: boolean;
|
||||||
|
declare var chrome: ExtensionContext;
|
||||||
|
declare var browser: ExtensionContext;
|
||||||
|
declare var __parcel__import__: (string) => Promise<void>;
|
||||||
|
declare var __parcel__importScripts__: (string) => Promise<void>;
|
||||||
|
declare var globalThis: typeof self;
|
||||||
|
declare var ServiceWorkerGlobalScope: Object;
|
||||||
|
*/ var OVERLAY_ID = '__parcel__error__overlay__';
|
||||||
|
var OldModule = module.bundle.Module;
|
||||||
|
function Module(moduleName) {
|
||||||
|
OldModule.call(this, moduleName);
|
||||||
|
this.hot = {
|
||||||
|
data: module.bundle.hotData[moduleName],
|
||||||
|
_acceptCallbacks: [],
|
||||||
|
_disposeCallbacks: [],
|
||||||
|
accept: function(fn) {
|
||||||
|
this._acceptCallbacks.push(fn || function() {});
|
||||||
|
},
|
||||||
|
dispose: function(fn) {
|
||||||
|
this._disposeCallbacks.push(fn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
module.bundle.hotData[moduleName] = undefined;
|
||||||
|
}
|
||||||
|
module.bundle.Module = Module;
|
||||||
|
module.bundle.hotData = {};
|
||||||
|
var checkedAssets /*: {|[string]: boolean|} */ , disposedAssets /*: {|[string]: boolean|} */ , assetsToDispose /*: Array<[ParcelRequire, string]> */ , assetsToAccept /*: Array<[ParcelRequire, string]> */ ;
|
||||||
|
function getHostname() {
|
||||||
|
return HMR_HOST || (location.protocol.indexOf('http') === 0 ? location.hostname : 'localhost');
|
||||||
|
}
|
||||||
|
function getPort() {
|
||||||
|
return HMR_PORT || location.port;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-redeclare
|
||||||
|
var parent = module.bundle.parent;
|
||||||
|
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
||||||
|
var hostname = getHostname();
|
||||||
|
var port = getPort();
|
||||||
|
var protocol = HMR_SECURE || location.protocol == 'https:' && ![
|
||||||
|
'localhost',
|
||||||
|
'127.0.0.1',
|
||||||
|
'0.0.0.0'
|
||||||
|
].includes(hostname) ? 'wss' : 'ws';
|
||||||
|
var ws;
|
||||||
|
if (HMR_USE_SSE) ws = new EventSource('/__parcel_hmr');
|
||||||
|
else try {
|
||||||
|
ws = new WebSocket(protocol + '://' + hostname + (port ? ':' + port : '') + '/');
|
||||||
|
} catch (err) {
|
||||||
|
if (err.message) console.error(err.message);
|
||||||
|
ws = {};
|
||||||
|
}
|
||||||
|
// Web extension context
|
||||||
|
var extCtx = typeof browser === 'undefined' ? typeof chrome === 'undefined' ? null : chrome : browser;
|
||||||
|
// Safari doesn't support sourceURL in error stacks.
|
||||||
|
// eval may also be disabled via CSP, so do a quick check.
|
||||||
|
var supportsSourceURL = false;
|
||||||
|
try {
|
||||||
|
(0, eval)('throw new Error("test"); //# sourceURL=test.js');
|
||||||
|
} catch (err) {
|
||||||
|
supportsSourceURL = err.stack.includes('test.js');
|
||||||
|
}
|
||||||
|
// $FlowFixMe
|
||||||
|
ws.onmessage = async function(event /*: {data: string, ...} */ ) {
|
||||||
|
checkedAssets = {} /*: {|[string]: boolean|} */ ;
|
||||||
|
disposedAssets = {} /*: {|[string]: boolean|} */ ;
|
||||||
|
assetsToAccept = [];
|
||||||
|
assetsToDispose = [];
|
||||||
|
var data /*: HMRMessage */ = JSON.parse(event.data);
|
||||||
|
if (data.type === 'reload') fullReload();
|
||||||
|
else if (data.type === 'update') {
|
||||||
|
// Remove error overlay if there is one
|
||||||
|
if (typeof document !== 'undefined') removeErrorOverlay();
|
||||||
|
let assets = data.assets.filter((asset)=>asset.envHash === HMR_ENV_HASH);
|
||||||
|
// Handle HMR Update
|
||||||
|
let handled = assets.every((asset)=>{
|
||||||
|
return asset.type === 'css' || asset.type === 'js' && hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle);
|
||||||
|
});
|
||||||
|
if (handled) {
|
||||||
|
console.clear();
|
||||||
|
// Dispatch custom event so other runtimes (e.g React Refresh) are aware.
|
||||||
|
if (typeof window !== 'undefined' && typeof CustomEvent !== 'undefined') window.dispatchEvent(new CustomEvent('parcelhmraccept'));
|
||||||
|
await hmrApplyUpdates(assets);
|
||||||
|
hmrDisposeQueue();
|
||||||
|
// Run accept callbacks. This will also re-execute other disposed assets in topological order.
|
||||||
|
let processedAssets = {};
|
||||||
|
for(let i = 0; i < assetsToAccept.length; i++){
|
||||||
|
let id = assetsToAccept[i][1];
|
||||||
|
if (!processedAssets[id]) {
|
||||||
|
hmrAccept(assetsToAccept[i][0], id);
|
||||||
|
processedAssets[id] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else fullReload();
|
||||||
|
}
|
||||||
|
if (data.type === 'error') {
|
||||||
|
// Log parcel errors to console
|
||||||
|
for (let ansiDiagnostic of data.diagnostics.ansi){
|
||||||
|
let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack;
|
||||||
|
console.error("\uD83D\uDEA8 [parcel]: " + ansiDiagnostic.message + '\n' + stack + '\n\n' + ansiDiagnostic.hints.join('\n'));
|
||||||
|
}
|
||||||
|
if (typeof document !== 'undefined') {
|
||||||
|
// Render the fancy html overlay
|
||||||
|
removeErrorOverlay();
|
||||||
|
var overlay = createErrorOverlay(data.diagnostics.html);
|
||||||
|
// $FlowFixMe
|
||||||
|
document.body.appendChild(overlay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (ws instanceof WebSocket) {
|
||||||
|
ws.onerror = function(e) {
|
||||||
|
if (e.message) console.error(e.message);
|
||||||
|
};
|
||||||
|
ws.onclose = function() {
|
||||||
|
console.warn("[parcel] \uD83D\uDEA8 Connection to the HMR server was lost");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function removeErrorOverlay() {
|
||||||
|
var overlay = document.getElementById(OVERLAY_ID);
|
||||||
|
if (overlay) {
|
||||||
|
overlay.remove();
|
||||||
|
console.log("[parcel] \u2728 Error resolved");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function createErrorOverlay(diagnostics) {
|
||||||
|
var overlay = document.createElement('div');
|
||||||
|
overlay.id = OVERLAY_ID;
|
||||||
|
let errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">';
|
||||||
|
for (let diagnostic of diagnostics){
|
||||||
|
let stack = diagnostic.frames.length ? diagnostic.frames.reduce((p, frame)=>{
|
||||||
|
return `${p}
|
||||||
|
<a href="/__parcel_launch_editor?file=${encodeURIComponent(frame.location)}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${frame.location}</a>
|
||||||
|
${frame.code}`;
|
||||||
|
}, '') : diagnostic.stack;
|
||||||
|
errorHTML += `
|
||||||
|
<div>
|
||||||
|
<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">
|
||||||
|
\u{1F6A8} ${diagnostic.message}
|
||||||
|
</div>
|
||||||
|
<pre>${stack}</pre>
|
||||||
|
<div>
|
||||||
|
${diagnostic.hints.map((hint)=>"<div>\uD83D\uDCA1 " + hint + '</div>').join('')}
|
||||||
|
</div>
|
||||||
|
${diagnostic.documentation ? `<div>\u{1F4DD} <a style="color: violet" href="${diagnostic.documentation}" target="_blank">Learn more</a></div>` : ''}
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
errorHTML += '</div>';
|
||||||
|
overlay.innerHTML = errorHTML;
|
||||||
|
return overlay;
|
||||||
|
}
|
||||||
|
function fullReload() {
|
||||||
|
if ('reload' in location) location.reload();
|
||||||
|
else if (extCtx && extCtx.runtime && extCtx.runtime.reload) extCtx.runtime.reload();
|
||||||
|
}
|
||||||
|
function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ {
|
||||||
|
var modules = bundle.modules;
|
||||||
|
if (!modules) return [];
|
||||||
|
var parents = [];
|
||||||
|
var k, d, dep;
|
||||||
|
for(k in modules)for(d in modules[k][1]){
|
||||||
|
dep = modules[k][1][d];
|
||||||
|
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) parents.push([
|
||||||
|
bundle,
|
||||||
|
k
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if (bundle.parent) parents = parents.concat(getParents(bundle.parent, id));
|
||||||
|
return parents;
|
||||||
|
}
|
||||||
|
function updateLink(link) {
|
||||||
|
var href = link.getAttribute('href');
|
||||||
|
if (!href) return;
|
||||||
|
var newLink = link.cloneNode();
|
||||||
|
newLink.onload = function() {
|
||||||
|
if (link.parentNode !== null) // $FlowFixMe
|
||||||
|
link.parentNode.removeChild(link);
|
||||||
|
};
|
||||||
|
newLink.setAttribute('href', // $FlowFixMe
|
||||||
|
href.split('?')[0] + '?' + Date.now());
|
||||||
|
// $FlowFixMe
|
||||||
|
link.parentNode.insertBefore(newLink, link.nextSibling);
|
||||||
|
}
|
||||||
|
var cssTimeout = null;
|
||||||
|
function reloadCSS() {
|
||||||
|
if (cssTimeout) return;
|
||||||
|
cssTimeout = setTimeout(function() {
|
||||||
|
var links = document.querySelectorAll('link[rel="stylesheet"]');
|
||||||
|
for(var i = 0; i < links.length; i++){
|
||||||
|
// $FlowFixMe[incompatible-type]
|
||||||
|
var href /*: string */ = links[i].getAttribute('href');
|
||||||
|
var hostname = getHostname();
|
||||||
|
var servedFromHMRServer = hostname === 'localhost' ? new RegExp('^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):' + getPort()).test(href) : href.indexOf(hostname + ':' + getPort());
|
||||||
|
var absolute = /^https?:\/\//i.test(href) && href.indexOf(location.origin) !== 0 && !servedFromHMRServer;
|
||||||
|
if (!absolute) updateLink(links[i]);
|
||||||
|
}
|
||||||
|
cssTimeout = null;
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
function hmrDownload(asset) {
|
||||||
|
if (asset.type === 'js') {
|
||||||
|
if (typeof document !== 'undefined') {
|
||||||
|
let script = document.createElement('script');
|
||||||
|
script.src = asset.url + '?t=' + Date.now();
|
||||||
|
if (asset.outputFormat === 'esmodule') script.type = 'module';
|
||||||
|
return new Promise((resolve, reject)=>{
|
||||||
|
var _document$head;
|
||||||
|
script.onload = ()=>resolve(script);
|
||||||
|
script.onerror = reject;
|
||||||
|
(_document$head = document.head) === null || _document$head === void 0 || _document$head.appendChild(script);
|
||||||
|
});
|
||||||
|
} else if (typeof importScripts === 'function') {
|
||||||
|
// Worker scripts
|
||||||
|
if (asset.outputFormat === 'esmodule') return import(asset.url + '?t=' + Date.now());
|
||||||
|
else return new Promise((resolve, reject)=>{
|
||||||
|
try {
|
||||||
|
importScripts(asset.url + '?t=' + Date.now());
|
||||||
|
resolve();
|
||||||
|
} catch (err) {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function hmrApplyUpdates(assets) {
|
||||||
|
global.parcelHotUpdate = Object.create(null);
|
||||||
|
let scriptsToRemove;
|
||||||
|
try {
|
||||||
|
// If sourceURL comments aren't supported in eval, we need to load
|
||||||
|
// the update from the dev server over HTTP so that stack traces
|
||||||
|
// are correct in errors/logs. This is much slower than eval, so
|
||||||
|
// we only do it if needed (currently just Safari).
|
||||||
|
// https://bugs.webkit.org/show_bug.cgi?id=137297
|
||||||
|
// This path is also taken if a CSP disallows eval.
|
||||||
|
if (!supportsSourceURL) {
|
||||||
|
let promises = assets.map((asset)=>{
|
||||||
|
var _hmrDownload;
|
||||||
|
return (_hmrDownload = hmrDownload(asset)) === null || _hmrDownload === void 0 ? void 0 : _hmrDownload.catch((err)=>{
|
||||||
|
// Web extension fix
|
||||||
|
if (extCtx && extCtx.runtime && extCtx.runtime.getManifest().manifest_version == 3 && typeof ServiceWorkerGlobalScope != 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
||||||
|
extCtx.runtime.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
scriptsToRemove = await Promise.all(promises);
|
||||||
|
}
|
||||||
|
assets.forEach(function(asset) {
|
||||||
|
hmrApply(module.bundle.root, asset);
|
||||||
|
});
|
||||||
|
} finally{
|
||||||
|
delete global.parcelHotUpdate;
|
||||||
|
if (scriptsToRemove) scriptsToRemove.forEach((script)=>{
|
||||||
|
if (script) {
|
||||||
|
var _document$head2;
|
||||||
|
(_document$head2 = document.head) === null || _document$head2 === void 0 || _document$head2.removeChild(script);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function hmrApply(bundle /*: ParcelRequire */ , asset /*: HMRAsset */ ) {
|
||||||
|
var modules = bundle.modules;
|
||||||
|
if (!modules) return;
|
||||||
|
if (asset.type === 'css') reloadCSS();
|
||||||
|
else if (asset.type === 'js') {
|
||||||
|
let deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID];
|
||||||
|
if (deps) {
|
||||||
|
if (modules[asset.id]) {
|
||||||
|
// Remove dependencies that are removed and will become orphaned.
|
||||||
|
// This is necessary so that if the asset is added back again, the cache is gone, and we prevent a full page reload.
|
||||||
|
let oldDeps = modules[asset.id][1];
|
||||||
|
for(let dep in oldDeps)if (!deps[dep] || deps[dep] !== oldDeps[dep]) {
|
||||||
|
let id = oldDeps[dep];
|
||||||
|
let parents = getParents(module.bundle.root, id);
|
||||||
|
if (parents.length === 1) hmrDelete(module.bundle.root, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (supportsSourceURL) // Global eval. We would use `new Function` here but browser
|
||||||
|
// support for source maps is better with eval.
|
||||||
|
(0, eval)(asset.output);
|
||||||
|
// $FlowFixMe
|
||||||
|
let fn = global.parcelHotUpdate[asset.id];
|
||||||
|
modules[asset.id] = [
|
||||||
|
fn,
|
||||||
|
deps
|
||||||
|
];
|
||||||
|
}
|
||||||
|
// Always traverse to the parent bundle, even if we already replaced the asset in this bundle.
|
||||||
|
// This is required in case modules are duplicated. We need to ensure all instances have the updated code.
|
||||||
|
if (bundle.parent) hmrApply(bundle.parent, asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function hmrDelete(bundle, id) {
|
||||||
|
let modules = bundle.modules;
|
||||||
|
if (!modules) return;
|
||||||
|
if (modules[id]) {
|
||||||
|
// Collect dependencies that will become orphaned when this module is deleted.
|
||||||
|
let deps = modules[id][1];
|
||||||
|
let orphans = [];
|
||||||
|
for(let dep in deps){
|
||||||
|
let parents = getParents(module.bundle.root, deps[dep]);
|
||||||
|
if (parents.length === 1) orphans.push(deps[dep]);
|
||||||
|
}
|
||||||
|
// Delete the module. This must be done before deleting dependencies in case of circular dependencies.
|
||||||
|
delete modules[id];
|
||||||
|
delete bundle.cache[id];
|
||||||
|
// Now delete the orphans.
|
||||||
|
orphans.forEach((id)=>{
|
||||||
|
hmrDelete(module.bundle.root, id);
|
||||||
|
});
|
||||||
|
} else if (bundle.parent) hmrDelete(bundle.parent, id);
|
||||||
|
}
|
||||||
|
function hmrAcceptCheck(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
|
||||||
|
if (hmrAcceptCheckOne(bundle, id, depsByBundle)) return true;
|
||||||
|
// Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload.
|
||||||
|
let parents = getParents(module.bundle.root, id);
|
||||||
|
let accepted = false;
|
||||||
|
while(parents.length > 0){
|
||||||
|
let v = parents.shift();
|
||||||
|
let a = hmrAcceptCheckOne(v[0], v[1], null);
|
||||||
|
if (a) // If this parent accepts, stop traversing upward, but still consider siblings.
|
||||||
|
accepted = true;
|
||||||
|
else {
|
||||||
|
// Otherwise, queue the parents in the next level upward.
|
||||||
|
let p = getParents(module.bundle.root, v[1]);
|
||||||
|
if (p.length === 0) {
|
||||||
|
// If there are no parents, then we've reached an entry without accepting. Reload.
|
||||||
|
accepted = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parents.push(...p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return accepted;
|
||||||
|
}
|
||||||
|
function hmrAcceptCheckOne(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
|
||||||
|
var modules = bundle.modules;
|
||||||
|
if (!modules) return;
|
||||||
|
if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) {
|
||||||
|
// If we reached the root bundle without finding where the asset should go,
|
||||||
|
// there's nothing to do. Mark as "accepted" so we don't reload the page.
|
||||||
|
if (!bundle.parent) return true;
|
||||||
|
return hmrAcceptCheck(bundle.parent, id, depsByBundle);
|
||||||
|
}
|
||||||
|
if (checkedAssets[id]) return true;
|
||||||
|
checkedAssets[id] = true;
|
||||||
|
var cached = bundle.cache[id];
|
||||||
|
assetsToDispose.push([
|
||||||
|
bundle,
|
||||||
|
id
|
||||||
|
]);
|
||||||
|
if (!cached || cached.hot && cached.hot._acceptCallbacks.length) {
|
||||||
|
assetsToAccept.push([
|
||||||
|
bundle,
|
||||||
|
id
|
||||||
|
]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function hmrDisposeQueue() {
|
||||||
|
// Dispose all old assets.
|
||||||
|
for(let i = 0; i < assetsToDispose.length; i++){
|
||||||
|
let id = assetsToDispose[i][1];
|
||||||
|
if (!disposedAssets[id]) {
|
||||||
|
hmrDispose(assetsToDispose[i][0], id);
|
||||||
|
disposedAssets[id] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assetsToDispose = [];
|
||||||
|
}
|
||||||
|
function hmrDispose(bundle /*: ParcelRequire */ , id /*: string */ ) {
|
||||||
|
var cached = bundle.cache[id];
|
||||||
|
bundle.hotData[id] = {};
|
||||||
|
if (cached && cached.hot) cached.hot.data = bundle.hotData[id];
|
||||||
|
if (cached && cached.hot && cached.hot._disposeCallbacks.length) cached.hot._disposeCallbacks.forEach(function(cb) {
|
||||||
|
cb(bundle.hotData[id]);
|
||||||
|
});
|
||||||
|
delete bundle.cache[id];
|
||||||
|
}
|
||||||
|
function hmrAccept(bundle /*: ParcelRequire */ , id /*: string */ ) {
|
||||||
|
// Execute the module.
|
||||||
|
bundle(id);
|
||||||
|
// Run the accept callbacks in the new version of the module.
|
||||||
|
var cached = bundle.cache[id];
|
||||||
|
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
|
||||||
|
let assetsToAlsoAccept = [];
|
||||||
|
cached.hot._acceptCallbacks.forEach(function(cb) {
|
||||||
|
let additionalAssets = cb(function() {
|
||||||
|
return getParents(module.bundle.root, id);
|
||||||
|
});
|
||||||
|
if (Array.isArray(additionalAssets) && additionalAssets.length) assetsToAlsoAccept.push(...additionalAssets);
|
||||||
|
});
|
||||||
|
if (assetsToAlsoAccept.length) {
|
||||||
|
let handled = assetsToAlsoAccept.every(function(a) {
|
||||||
|
return hmrAcceptCheck(a[0], a[1]);
|
||||||
|
});
|
||||||
|
if (!handled) return fullReload();
|
||||||
|
hmrDisposeQueue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],"5n6Un":[function(require,module,exports,__globalThis) {
|
||||||
|
|
||||||
|
},{}]},["dOfEu","5n6Un"], "5n6Un", "parcelRequire94c2")
|
||||||
|
|
||||||
|
//# sourceMappingURL=editor.767b7f59.js.map
|
1
dist/editor.767b7f59.js.map
vendored
Normal file
1
dist/editor.767b7f59.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
217
dist/index.23c89b7f.js
vendored
Normal file
217
dist/index.23c89b7f.js
vendored
Normal file
|
@ -0,0 +1,217 @@
|
||||||
|
let currentCode = '_';
|
||||||
|
const paletteEl = document.getElementById('palette');
|
||||||
|
Object.entries(palette).forEach(([code, color])=>{
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
Object.assign(btn.style, {
|
||||||
|
background: color || 'linear-gradient(45deg,black,white)',
|
||||||
|
display: 'inline-block',
|
||||||
|
width: '40px',
|
||||||
|
height: '40px',
|
||||||
|
border: '1px solid black'
|
||||||
|
});
|
||||||
|
if (code === currentCode) btn.className = 'active';
|
||||||
|
paletteEl.appendChild(btn);
|
||||||
|
btn.addEventListener('click', (e)=>{
|
||||||
|
currentCode = code;
|
||||||
|
e.preventDefault();
|
||||||
|
document.querySelector('#palette button.active')?.classList.remove('active');
|
||||||
|
btn.classList.add('active');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function renderAllLevels() {
|
||||||
|
allLevels.forEach((level, levelIndex)=>{
|
||||||
|
addLevelEditorToList(level, levelIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function addLevelEditorToList(level, levelIndex) {
|
||||||
|
const { name, bricks, size, svg, color } = level;
|
||||||
|
let div = document.createElement('div');
|
||||||
|
div.innerHTML = `
|
||||||
|
<button data-level="${levelIndex}" data-rename="yep">${name}</button>
|
||||||
|
<div>
|
||||||
|
<button data-level="${levelIndex}" data-delete="yep">Delete</button>
|
||||||
|
<button data-offset-level-size="-1" data-level="${levelIndex}">-</button>
|
||||||
|
<button data-offset-level-size="1" data-level="${levelIndex}">+</button>
|
||||||
|
<button data-offset-x="-1" data-offset-y="0" data-level="${levelIndex}">L</button>
|
||||||
|
<button data-offset-x="1" data-offset-y="0" data-level="${levelIndex}">R</button>
|
||||||
|
<button data-offset-x="0" data-offset-y="-1" data-level="${levelIndex}">U</button>
|
||||||
|
<button data-offset-x="0" data-offset-y="1" data-level="${levelIndex}">D</button>
|
||||||
|
<input type="color" value="${level.color || ''}" data-level="${levelIndex}" />
|
||||||
|
<input type="number" value="${level.svg || hashCode(level.name) % backgrounds.length}" data-level="${levelIndex}" data-num-val="svg" />
|
||||||
|
|
||||||
|
<button data-level="${levelIndex}" data-set-bg-svg="true" >${svg ? 'replace' : 'set'}</button>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="level-bricks-preview" id="bricks-of-${levelIndex}" >
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
document.getElementById('levels').appendChild(div);
|
||||||
|
renderLevelBricks(levelIndex);
|
||||||
|
updateLevelBackground(levelIndex);
|
||||||
|
}
|
||||||
|
function updateLevelBackground(levelIndex) {
|
||||||
|
const div = document.getElementById("bricks-of-" + levelIndex);
|
||||||
|
const level = allLevels[levelIndex];
|
||||||
|
const { svg, color } = level;
|
||||||
|
if (color) Object.assign(div.style, {
|
||||||
|
backgroundImage: 'none',
|
||||||
|
backgroundColor: color
|
||||||
|
});
|
||||||
|
else {
|
||||||
|
const index = svg || hashCode(level.name) % backgrounds.length;
|
||||||
|
const svgSource = backgrounds[index];
|
||||||
|
console.log(index);
|
||||||
|
div.setAttribute('data-svg', svgSource);
|
||||||
|
Object.assign(div.style, {
|
||||||
|
backgroundImage: `url("data:image/svg+xml;UTF8,${encodeURIComponent(svgSource)}")`,
|
||||||
|
backgroundColor: 'transparent'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function renderLevelBricks(levelIndex) {
|
||||||
|
const { size, bricks } = allLevels[levelIndex];
|
||||||
|
const buttons = [];
|
||||||
|
for(let x = 0; x < size; x++)for(let y = 0; y < size; y++){
|
||||||
|
const index = y * size + x;
|
||||||
|
buttons.push(`<button style="background: ${palette[bricks[index]] || 'transparent'}; left:${x * 40}px;top:${y * 40}px;width:40px;height: 40px; position: absolute" data-set-color-of="${index}" data-level="${levelIndex}"></button>`);
|
||||||
|
}
|
||||||
|
const div = document.getElementById("bricks-of-" + levelIndex);
|
||||||
|
div.innerHTML = buttons.join('');
|
||||||
|
Object.assign(div.style, {
|
||||||
|
width: size * 40 + 'px',
|
||||||
|
height: size * 40 + 'px'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
document.getElementById('levels').addEventListener('change', (e)=>{
|
||||||
|
const levelIndexStr = e.target.getAttribute('data-level');
|
||||||
|
if (levelIndexStr) {
|
||||||
|
const levelIndex = parseInt(levelIndexStr);
|
||||||
|
const level = allLevels[levelIndex];
|
||||||
|
if (e.target.getAttribute('type') === 'color') {
|
||||||
|
level.color = e.target.value;
|
||||||
|
level.svg = '';
|
||||||
|
updateLevelBackground(levelIndex);
|
||||||
|
} else if (e.target.getAttribute('type') === 'checkbox' && e.target.hasAttribute('data-field')) {
|
||||||
|
const field = e.target.getAttribute('data-field');
|
||||||
|
if (field === 'focus') allLevels.forEach((l)=>l.focus = false);
|
||||||
|
level[field] = !!e.target.checked;
|
||||||
|
}
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.getElementById('levels').addEventListener('click', (e)=>{
|
||||||
|
const resize = e.target.getAttribute('data-offset-level-size');
|
||||||
|
const moveX = e.target.getAttribute('data-offset-x');
|
||||||
|
const moveY = e.target.getAttribute('data-offset-y');
|
||||||
|
const levelIndexStr = e.target.getAttribute('data-level');
|
||||||
|
if (!levelIndexStr) return;
|
||||||
|
if (e.target.tagName !== 'BUTTON') return;
|
||||||
|
const levelIndex = parseInt(levelIndexStr);
|
||||||
|
const level = allLevels[levelIndex];
|
||||||
|
const { bricks, size } = level;
|
||||||
|
if (resize) {
|
||||||
|
const newSize = size + parseInt(resize);
|
||||||
|
const newBricks = new Array(newSize * newSize).fill('_');
|
||||||
|
for(let x = 0; x < Math.min(size, newSize); x++)for(let y = 0; y < Math.min(size, newSize); y++)newBricks[y * newSize + x] = bricks.split('')[y * size + x] || '_';
|
||||||
|
level.size = newSize;
|
||||||
|
level.bricks = newBricks.map((b)=>b || '_').join('');
|
||||||
|
} else if (moveX && moveY) {
|
||||||
|
const dx = parseInt(moveX), dy = parseInt(moveY);
|
||||||
|
const newBricks = new Array(size * size).fill('_');
|
||||||
|
for(let x = 0; x < size; x++)for(let y = 0; y < size; y++)newBricks[(y + dy) * size + (x + dx)] = bricks.split('')[y * size + x] || '_';
|
||||||
|
level.bricks = newBricks.map((b)=>b || '_').join('');
|
||||||
|
} else if (e.target.getAttribute('data-rename')) {
|
||||||
|
const newName = prompt('Name ? ', level.name);
|
||||||
|
if (newName) {
|
||||||
|
level.name = newName;
|
||||||
|
e.target.textContent = newName;
|
||||||
|
}
|
||||||
|
} else if (e.target.getAttribute('data-delete')) {
|
||||||
|
if (confirm('Delete level')) {
|
||||||
|
allLevels = allLevels.filter((l, i)=>i !== levelIndex);
|
||||||
|
save().then(()=>window.location.reload());
|
||||||
|
}
|
||||||
|
} else if (e.target.getAttribute('data-set-bg-svg')) {
|
||||||
|
const newBg = prompt('New svg code', level.svg || '');
|
||||||
|
if (newBg) {
|
||||||
|
level.svg = newBg;
|
||||||
|
level.color = '';
|
||||||
|
}
|
||||||
|
updateLevelBackground(levelIndex);
|
||||||
|
}
|
||||||
|
renderLevelBricks(levelIndex);
|
||||||
|
save();
|
||||||
|
}, true);
|
||||||
|
let applying = '';
|
||||||
|
function colorPixel(e) {
|
||||||
|
if (applying === '') return;
|
||||||
|
console.log('colorPixel', applying);
|
||||||
|
const index = e.target.getAttribute('data-set-color-of');
|
||||||
|
const level = e.target.getAttribute('data-level');
|
||||||
|
if (index && level) {
|
||||||
|
const levelIndex = parseInt(level);
|
||||||
|
e.target.style.background = palette[applying] || 'transparent';
|
||||||
|
setBrick(levelIndex, parseInt(index), applying);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function setBrick(levelIndex, index, chr) {
|
||||||
|
const bricks = allLevels[levelIndex].bricks;
|
||||||
|
allLevels[levelIndex].bricks = bricks.substring(0, index) + chr + bricks.substring(index + 1);
|
||||||
|
}
|
||||||
|
document.getElementById('levels').addEventListener('mousedown', (e)=>{
|
||||||
|
const index = parseInt(e.target.getAttribute('data-set-color-of'));
|
||||||
|
const level = e.target.getAttribute('data-level');
|
||||||
|
if (typeof index !== "undefined" && level) {
|
||||||
|
const before = allLevels[parseInt(level)].bricks[index] || '';
|
||||||
|
applying = before === currentCode ? '_' : currentCode;
|
||||||
|
console.log({
|
||||||
|
before,
|
||||||
|
applying,
|
||||||
|
currentCode
|
||||||
|
});
|
||||||
|
colorPixel(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.getElementById('levels').addEventListener('mouseenter', (e)=>{
|
||||||
|
if (applying !== '') colorPixel(e);
|
||||||
|
}, true);
|
||||||
|
document.addEventListener('mouseup', (e)=>{
|
||||||
|
applying = '';
|
||||||
|
save();
|
||||||
|
});
|
||||||
|
document.getElementById('new-level').addEventListener('click', (e)=>{
|
||||||
|
const name = prompt("Name ? ");
|
||||||
|
if (!name) return;
|
||||||
|
allLevels.push({
|
||||||
|
name,
|
||||||
|
size: 8,
|
||||||
|
bricks: '',
|
||||||
|
svg: ''
|
||||||
|
});
|
||||||
|
const levelIndex = allLevels.length - 1;
|
||||||
|
addLevelEditorToList(allLevels[levelIndex], levelIndex);
|
||||||
|
save();
|
||||||
|
}, true);
|
||||||
|
renderAllLevels();
|
||||||
|
function save() {
|
||||||
|
return fetch('/', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(allLevels, null, 2)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function hashCode(string) {
|
||||||
|
var hash = 0;
|
||||||
|
for(var i = 0; i < string.length; i++){
|
||||||
|
var code = string.charCodeAt(i);
|
||||||
|
hash = (hash << 5) - hash + code;
|
||||||
|
hash = hash & hash; // Convert to 32bit integer
|
||||||
|
}
|
||||||
|
return Math.abs(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
//# sourceMappingURL=index.23c89b7f.js.map
|
1
dist/index.23c89b7f.js.map
vendored
Normal file
1
dist/index.23c89b7f.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
52
dist/index.25267e01.css
vendored
Normal file
52
dist/index.25267e01.css
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
body {
|
||||||
|
color: #fff;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#palette {
|
||||||
|
width: 80px;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#palette button.active {
|
||||||
|
transform: scale(1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 40px;
|
||||||
|
margin-right: 80px;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels .level-bricks-preview {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels > div {
|
||||||
|
grid-template-columns: auto auto;
|
||||||
|
grid-template-areas: ". name"
|
||||||
|
"buttons bricks";
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels > div > :first-child {
|
||||||
|
grid-area: name;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels > div > div:nth-child(2) {
|
||||||
|
flex-direction: column;
|
||||||
|
grid-area: buttons;
|
||||||
|
align-items: flex-end;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels > div > div:nth-child(3) {
|
||||||
|
grid-area: bricks;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=index.25267e01.css.map */
|
1
dist/index.25267e01.css.map
vendored
Normal file
1
dist/index.25267e01.css.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"mappings":"AACA;;;;;AAKA;;;;;;;;;AAAA;;;;AAcA;;;;;;;;AAAA;;;;AAWE;;;;;;;AAKE;;;;AAIA;;;;;;;AAOA","sources":["editor/editclient.less"],"sourcesContent":["\nbody {\n background: black;\n color: white;\n}\n\n#palette {\n position: fixed;\n top: 0;\n right: 0;\n width: 80px;\n bottom: 0;\n overflow: auto;\n\n button.active {\n transform: scale(1.2);\n }\n\n}\n\n#levels {\n display: flex;\n gap: 40px;\n align-items: flex-start;\n flex-wrap: wrap;\n margin-right: 80px;\n\n.level-bricks-preview {\n position: relative;\n}\n\n & > div {\n display: grid;\n grid-template-columns: auto auto;\n grid-template-areas: \". name\" \"buttons bricks\";\n\n & > *:nth-child(1) {\n grid-area: name;\n }\n\n & > div:nth-child(2) {\n grid-area: buttons;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n }\n\n & > div:nth-child(3) {\n grid-area: bricks;\n }\n\n }\n\n}\n\n"],"names":[],"version":3,"file":"index.25267e01.css.map","sourceRoot":"/__parcel_source_root/"}
|
52
dist/index.74a459a7.css
vendored
Normal file
52
dist/index.74a459a7.css
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
body {
|
||||||
|
color: #fff;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#palette button.active {
|
||||||
|
transform: scale(1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.level-bricks-preview {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#palette {
|
||||||
|
width: 80px;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 40px;
|
||||||
|
margin-right: 80px;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels > div {
|
||||||
|
grid-template-columns: auto auto;
|
||||||
|
grid-template-areas: ". name"
|
||||||
|
"buttons bricks";
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels > div > :first-child {
|
||||||
|
grid-area: name;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels > div > div:nth-child(2) {
|
||||||
|
flex-direction: column;
|
||||||
|
grid-area: buttons;
|
||||||
|
align-items: flex-end;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels > div > div:nth-child(3) {
|
||||||
|
grid-area: bricks;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=index.74a459a7.css.map */
|
1
dist/index.74a459a7.css.map
vendored
Normal file
1
dist/index.74a459a7.css.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"mappings":"AACA;;;;;AAKA;;;;AAIA;;;;AAIA;;;;;;;;;AASA;;;;;;;;AASA;;;;;;;AAKA;;;;AAGA;;;;;;;AAMA","sources":["editor/editclient.css"],"sourcesContent":["\nbody {\n background: black;\n color: white;\n}\n\n#palette button.active {\n transform: scale(1.2);\n}\n\n.level-bricks-preview {\n position: relative;\n}\n\n#palette {\n position: fixed;\n top: 0;\n right: 0;\n width: 80px;\n bottom: 0;\n overflow: auto;\n}\n\n#levels {\n display: flex;\n gap: 40px;\n align-items: flex-start;\n flex-wrap: wrap;\n margin-right: 80px;\n}\n\n\n#levels>div {\n display: grid;\n grid-template-columns: auto auto;\n grid-template-areas: \". name\" \"buttons bricks\";\n}\n#levels>div>*:nth-child(1) {\n grid-area: name;\n}\n#levels>div>div:nth-child(2) {\n grid-area: buttons;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n}\n#levels>div>div:nth-child(3) {\n grid-area: bricks;\n}\n"],"names":[],"version":3,"file":"index.74a459a7.css.map","sourceRoot":"/__parcel_source_root/"}
|
217
dist/index.e2e3b31c.js
vendored
Normal file
217
dist/index.e2e3b31c.js
vendored
Normal file
|
@ -0,0 +1,217 @@
|
||||||
|
let currentCode = '_';
|
||||||
|
const paletteEl = document.getElementById('palette');
|
||||||
|
Object.entries(palette).forEach(([code, color])=>{
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
Object.assign(btn.style, {
|
||||||
|
background: color || 'linear-gradient(45deg,black,white)',
|
||||||
|
display: 'inline-block',
|
||||||
|
width: '40px',
|
||||||
|
height: '40px',
|
||||||
|
border: '1px solid black'
|
||||||
|
});
|
||||||
|
if (code === currentCode) btn.className = 'active';
|
||||||
|
paletteEl.appendChild(btn);
|
||||||
|
btn.addEventListener('click', (e)=>{
|
||||||
|
currentCode = code;
|
||||||
|
e.preventDefault();
|
||||||
|
document.querySelector('#palette button.active')?.classList.remove('active');
|
||||||
|
btn.classList.add('active');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function renderAllLevels() {
|
||||||
|
allLevels.forEach((level, levelIndex)=>{
|
||||||
|
addLevelEditorToList(level, levelIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function addLevelEditorToList(level, levelIndex) {
|
||||||
|
const { name, bricks, size, svg, color } = level;
|
||||||
|
let div = document.createElement('div');
|
||||||
|
div.innerHTML = `
|
||||||
|
<button data-level="${levelIndex}" data-rename="yep">${name}</button>
|
||||||
|
<div>
|
||||||
|
<button data-level="${levelIndex}" data-delete="yep">Delete</button>
|
||||||
|
<button data-offset-level-size="-1" data-level="${levelIndex}">-</button>
|
||||||
|
<button data-offset-level-size="1" data-level="${levelIndex}">+</button>
|
||||||
|
<button data-offset-x="-1" data-offset-y="0" data-level="${levelIndex}">L</button>
|
||||||
|
<button data-offset-x="1" data-offset-y="0" data-level="${levelIndex}">R</button>
|
||||||
|
<button data-offset-x="0" data-offset-y="-1" data-level="${levelIndex}">U</button>
|
||||||
|
<button data-offset-x="0" data-offset-y="1" data-level="${levelIndex}">D</button>
|
||||||
|
<input type="color" value="${level.color || ''}" data-level="${levelIndex}" />
|
||||||
|
<input type="number" value="${level.svg || hashCode(level.name) % backgrounds.length}" data-level="${levelIndex}" data-num-val="svg" />
|
||||||
|
|
||||||
|
<button data-level="${levelIndex}" data-set-bg-svg="true" >${svg ? 'replace' : 'set'}</button>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="level-bricks-preview" id="bricks-of-${levelIndex}" >
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
document.getElementById('levels').appendChild(div);
|
||||||
|
renderLevelBricks(levelIndex);
|
||||||
|
updateLevelBackground(levelIndex);
|
||||||
|
}
|
||||||
|
function updateLevelBackground(levelIndex) {
|
||||||
|
const div = document.getElementById("bricks-of-" + levelIndex);
|
||||||
|
const level = allLevels[levelIndex];
|
||||||
|
const { svg, color } = level;
|
||||||
|
if (color) Object.assign(div.style, {
|
||||||
|
backgroundImage: 'none',
|
||||||
|
backgroundColor: color
|
||||||
|
});
|
||||||
|
else {
|
||||||
|
const index = svg || hashCode(level.name) % backgrounds.length;
|
||||||
|
const svgSource = backgrounds[index];
|
||||||
|
console.log(index);
|
||||||
|
div.setAttribute('data-svg', svgSource);
|
||||||
|
Object.assign(div.style, {
|
||||||
|
backgroundImage: `url("data:image/svg+xml;UTF8,${encodeURIComponent(svgSource)}")`,
|
||||||
|
backgroundColor: 'transparent'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function renderLevelBricks(levelIndex) {
|
||||||
|
const { size, bricks } = allLevels[levelIndex];
|
||||||
|
const buttons = [];
|
||||||
|
for(let x = 0; x < size; x++)for(let y = 0; y < size; y++){
|
||||||
|
const index = y * size + x;
|
||||||
|
buttons.push(`<button style="background: ${palette[bricks[index]] || 'transparent'}; left:${x * 40}px;top:${y * 40}px;width:40px;height: 40px; position: absolute" data-set-color-of="${index}" data-level="${levelIndex}"></button>`);
|
||||||
|
}
|
||||||
|
const div = document.getElementById("bricks-of-" + levelIndex);
|
||||||
|
div.innerHTML = buttons.join('');
|
||||||
|
Object.assign(div.style, {
|
||||||
|
width: size * 40 + 'px',
|
||||||
|
height: size * 40 + 'px'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
document.getElementById('levels').addEventListener('change', (e)=>{
|
||||||
|
const levelIndexStr = e.target.getAttribute('data-level');
|
||||||
|
if (levelIndexStr) {
|
||||||
|
const levelIndex = parseInt(levelIndexStr);
|
||||||
|
const level = allLevels[levelIndex];
|
||||||
|
if (e.target.getAttribute('type') === 'color') {
|
||||||
|
level.color = e.target.value;
|
||||||
|
level.svg = '';
|
||||||
|
updateLevelBackground(levelIndex);
|
||||||
|
} else if (e.target.getAttribute('type') === 'checkbox' && e.target.hasAttribute('data-field')) {
|
||||||
|
const field = e.target.getAttribute('data-field');
|
||||||
|
if (field === 'focus') allLevels.forEach((l)=>l.focus = false);
|
||||||
|
level[field] = !!e.target.checked;
|
||||||
|
}
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.getElementById('levels').addEventListener('click', (e)=>{
|
||||||
|
const resize = e.target.getAttribute('data-offset-level-size');
|
||||||
|
const moveX = e.target.getAttribute('data-offset-x');
|
||||||
|
const moveY = e.target.getAttribute('data-offset-y');
|
||||||
|
const levelIndexStr = e.target.getAttribute('data-level');
|
||||||
|
if (!levelIndexStr) return;
|
||||||
|
if (e.target.tagName !== 'BUTTON') return;
|
||||||
|
const levelIndex = parseInt(levelIndexStr);
|
||||||
|
const level = allLevels[levelIndex];
|
||||||
|
const { bricks, size } = level;
|
||||||
|
if (resize) {
|
||||||
|
const newSize = size + parseInt(resize);
|
||||||
|
const newBricks = new Array(newSize * newSize).fill('_');
|
||||||
|
for(let x = 0; x < Math.min(size, newSize); x++)for(let y = 0; y < Math.min(size, newSize); y++)newBricks[y * newSize + x] = bricks.split('')[y * size + x] || '_';
|
||||||
|
level.size = newSize;
|
||||||
|
level.bricks = newBricks.map((b)=>b || '_').join('');
|
||||||
|
} else if (moveX && moveY) {
|
||||||
|
const dx = parseInt(moveX), dy = parseInt(moveY);
|
||||||
|
const newBricks = new Array(size * size).fill('_');
|
||||||
|
for(let x = 0; x < size; x++)for(let y = 0; y < size; y++)newBricks[(y + dy) * size + (x + dx)] = bricks.split('')[y * size + x] || '_';
|
||||||
|
level.bricks = newBricks.map((b)=>b || '_').join('');
|
||||||
|
} else if (e.target.getAttribute('data-rename')) {
|
||||||
|
const newName = prompt('Name ? ', level.name);
|
||||||
|
if (newName) {
|
||||||
|
level.name = newName;
|
||||||
|
e.target.textContent = newName;
|
||||||
|
}
|
||||||
|
} else if (e.target.getAttribute('data-delete')) {
|
||||||
|
if (confirm('Delete level')) {
|
||||||
|
allLevels = allLevels.filter((l, i)=>i !== levelIndex);
|
||||||
|
save().then(()=>window.location.reload());
|
||||||
|
}
|
||||||
|
} else if (e.target.getAttribute('data-set-bg-svg')) {
|
||||||
|
const newBg = prompt('New svg code', level.svg || '');
|
||||||
|
if (newBg) {
|
||||||
|
level.svg = newBg;
|
||||||
|
level.color = '';
|
||||||
|
}
|
||||||
|
updateLevelBackground(levelIndex);
|
||||||
|
}
|
||||||
|
renderLevelBricks(levelIndex);
|
||||||
|
save();
|
||||||
|
}, true);
|
||||||
|
let applying = '';
|
||||||
|
function colorPixel(e) {
|
||||||
|
if (applying === '') return;
|
||||||
|
console.log('colorPixel', applying);
|
||||||
|
const index = e.target.getAttribute('data-set-color-of');
|
||||||
|
const level = e.target.getAttribute('data-level');
|
||||||
|
if (index && level) {
|
||||||
|
const levelIndex = parseInt(level);
|
||||||
|
e.target.style.background = palette[applying] || 'transparent';
|
||||||
|
setBrick(levelIndex, parseInt(index), applying);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function setBrick(levelIndex, index, chr) {
|
||||||
|
const bricks = allLevels[levelIndex].bricks;
|
||||||
|
allLevels[levelIndex].bricks = bricks.substring(0, index) + chr + bricks.substring(index + 1);
|
||||||
|
}
|
||||||
|
document.getElementById('levels').addEventListener('mousedown', (e)=>{
|
||||||
|
const index = parseInt(e.target.getAttribute('data-set-color-of'));
|
||||||
|
const level = e.target.getAttribute('data-level');
|
||||||
|
if (typeof index !== "undefined" && level) {
|
||||||
|
const before = allLevels[parseInt(level)].bricks[index] || '';
|
||||||
|
applying = before === currentCode ? '_' : currentCode;
|
||||||
|
console.log({
|
||||||
|
before,
|
||||||
|
applying,
|
||||||
|
currentCode
|
||||||
|
});
|
||||||
|
colorPixel(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.getElementById('levels').addEventListener('mouseenter', (e)=>{
|
||||||
|
if (applying !== '') colorPixel(e);
|
||||||
|
}, true);
|
||||||
|
document.addEventListener('mouseup', (e)=>{
|
||||||
|
applying = '';
|
||||||
|
save();
|
||||||
|
});
|
||||||
|
document.getElementById('new-level').addEventListener('click', (e)=>{
|
||||||
|
const name = prompt("Name ? ");
|
||||||
|
if (!name) return;
|
||||||
|
allLevels.push({
|
||||||
|
name,
|
||||||
|
size: 8,
|
||||||
|
bricks: '',
|
||||||
|
svg: ''
|
||||||
|
});
|
||||||
|
const levelIndex = allLevels.length - 1;
|
||||||
|
addLevelEditorToList(allLevels[levelIndex], levelIndex);
|
||||||
|
save();
|
||||||
|
}, true);
|
||||||
|
renderAllLevels();
|
||||||
|
function save() {
|
||||||
|
return fetch('/', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(allLevels, null, 2)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function hashCode(string) {
|
||||||
|
var hash = 0;
|
||||||
|
for(var i = 0; i < string.length; i++){
|
||||||
|
var code = string.charCodeAt(i);
|
||||||
|
hash = (hash << 5) - hash + code;
|
||||||
|
hash = hash & hash; // Convert to 32bit integer
|
||||||
|
}
|
||||||
|
return Math.abs(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
//# sourceMappingURL=index.e2e3b31c.js.map
|
1
dist/index.e2e3b31c.js.map
vendored
Normal file
1
dist/index.e2e3b31c.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
129
dist/index.html
vendored
129
dist/index.html
vendored
File diff suppressed because one or more lines are too long
|
@ -1,49 +0,0 @@
|
||||||
|
|
||||||
body {
|
|
||||||
background: black;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
#palette button.active {
|
|
||||||
transform: scale(1.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.level-bricks-preview {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
#palette {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
width: 80px;
|
|
||||||
bottom: 0;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#levels {
|
|
||||||
display: flex;
|
|
||||||
gap: 40px;
|
|
||||||
align-items: flex-start;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin-right: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#levels>div {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: auto auto;
|
|
||||||
grid-template-areas: ". name" "buttons bricks";
|
|
||||||
}
|
|
||||||
#levels>div>*:nth-child(1) {
|
|
||||||
grid-area: name;
|
|
||||||
}
|
|
||||||
#levels>div>div:nth-child(2) {
|
|
||||||
grid-area: buttons;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-end;
|
|
||||||
}
|
|
||||||
#levels>div>div:nth-child(3) {
|
|
||||||
grid-area: bricks;
|
|
||||||
}
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
console.log('WTF')
|
||||||
|
|
||||||
let currentCode = '_'
|
let currentCode = '_'
|
||||||
|
|
||||||
const paletteEl = document.getElementById('palette');
|
const paletteEl = document.getElementById('palette');
|
55
editor/editclient.less
Normal file
55
editor/editclient.less
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#palette {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 80px;
|
||||||
|
bottom: 0;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
button.active {
|
||||||
|
transform: scale(1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#levels {
|
||||||
|
display: flex;
|
||||||
|
gap: 40px;
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-right: 80px;
|
||||||
|
|
||||||
|
.level-bricks-preview {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > div {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto auto;
|
||||||
|
grid-template-areas: ". name" "buttons bricks";
|
||||||
|
|
||||||
|
& > *:nth-child(1) {
|
||||||
|
grid-area: name;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > div:nth-child(2) {
|
||||||
|
grid-area: buttons;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > div:nth-child(3) {
|
||||||
|
grid-area: bricks;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
20
editor/index.html
Normal file
20
editor/index.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Level editor</title>
|
||||||
|
<link rel="icon"
|
||||||
|
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎨</text></svg>"
|
||||||
|
/>
|
||||||
|
<link rel="stylesheet" href="./editclient.less"/>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="levels"></div>
|
||||||
|
<div id="palette">
|
||||||
|
<button id="new-level">new</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="./editclient.ts"></script>
|
||||||
|
</body>
|
|
@ -10,36 +10,6 @@ app.use(bodyParser.text({
|
||||||
limit:'1MB'
|
limit:'1MB'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
|
||||||
res.end(`<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Level editor</title>
|
|
||||||
<link rel="icon"
|
|
||||||
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎨</text></svg>"
|
|
||||||
/>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div id="levels"></div>
|
|
||||||
<div id="palette">
|
|
||||||
<button id="new-level">new</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
${fs.readFileSync('./editclient.css').toString()}
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
let allLevels = ${fs.readFileSync(srcPath).toString()};
|
|
||||||
let palette = ${fs.readFileSync('src/palette.json').toString()};
|
|
||||||
let backgrounds = ${fs.readFileSync('src/backgrounds.json').toString()};
|
|
||||||
${fs.readFileSync('./editclient.js').toString()}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
app.post('/', (req, res) => {
|
app.post('/', (req, res) => {
|
||||||
if(req.body?.trim()) {
|
if(req.body?.trim()) {
|
||||||
fs.writeFileSync(srcPath, req.body)
|
fs.writeFileSync(srcPath, req.body)
|
||||||
|
|
2077
package-lock.json
generated
2077
package-lock.json
generated
File diff suppressed because it is too large
Load diff
22
package.json
22
package.json
|
@ -1,21 +1,23 @@
|
||||||
{
|
{
|
||||||
"name": "breakout.lecaro.me",
|
"name": "breakout.lecaro.me",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "A roguelite take on the breakout genre, optimised for short runs and replayability.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "parcel src/index.html",
|
"start": "run-p dev:*",
|
||||||
"build": "rm -f dist/* && parcel build src/index.html",
|
"dev:game-fe": "parcel --port 1234 --open src/index.html",
|
||||||
"editor": "nodemon editserver.js --watch editserver.js"
|
"dev:editor-fe": "parcel --port 4401 --open editor/index.html",
|
||||||
|
"dev:editor-be": "nodemon editserver.js --watch editserver.js",
|
||||||
|
"build": "rm -f dist/* && parcel build src/index.html"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "Renan LE CARO",
|
||||||
"license": "ISC",
|
"license": "GNU AGPLv3",
|
||||||
"dependencies": {
|
"devDependencies": {
|
||||||
|
"@parcel/transformer-less": "^2.13.3",
|
||||||
"body-parser": "^1.20.3",
|
"body-parser": "^1.20.3",
|
||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
"http-server": "^14.1.1",
|
"http-server": "^14.1.1",
|
||||||
"nodemon": "^3.1.9"
|
"nodemon": "^3.1.9",
|
||||||
},
|
"npm-run-all": "^4.1.5",
|
||||||
"devDependencies": {
|
|
||||||
"parcel": "^2.13.3",
|
"parcel": "^2.13.3",
|
||||||
"svgo": "^3.3.2"
|
"svgo": "^3.3.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,10 @@ export const rawUpgrades = [
|
||||||
name: "+1 life",
|
name: "+1 life",
|
||||||
max: 7,
|
max: 7,
|
||||||
help: (lvl: number) =>
|
help: (lvl: number) =>
|
||||||
`Survive dropping the ball ${lvl} time${lvl > 1 ? "s" : ""}.`,
|
`The ball will bounce on the bottom ${lvl} time${lvl > 1 ? "s" : ""} before being lost.`,
|
||||||
fullHelp: `Normally, you just have one life, and the run is over as soon as you drop it.
|
fullHelp: `Normally, you have one ball per run, and the run is over as soon as you drop it.
|
||||||
With this perk, you can survive dropping the ball once. A heart in the top right corner will remind you of how many extra lives you have. `,
|
This perk adds a white bar at the bottom of the screen that will save a ball once, and break in the process.
|
||||||
|
You'll loose one level of that perk every time a ball bounces at the bottom of the screen. `,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
requires: "",
|
requires: "",
|
||||||
|
@ -163,8 +164,7 @@ export const rawUpgrades = [
|
||||||
max: 6,
|
max: 6,
|
||||||
help: (lvl: number) => `Start every levels with ${lvl + 1} balls.`,
|
help: (lvl: number) => `Start every levels with ${lvl + 1} balls.`,
|
||||||
fullHelp: `As soon as you drop the ball in Breakout 71, you loose. With this perk, you get two balls, and so you can afford to lose one.
|
fullHelp: `As soon as you drop the ball in Breakout 71, you loose. With this perk, you get two balls, and so you can afford to lose one.
|
||||||
The lost balls come back on the next level or whenever you use one of your extra lives, if you picked that perk. Having more than one balls makes
|
The lost balls come back on the next level. Having more than one balls makes some further perks available, and of course clears the level faster.`,
|
||||||
some further perks available, and of course clears the level faster.`,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
requires: "",
|
requires: "",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue