From b88c0eb358cc2b3d7bf24a1c71ace40513406c89 Mon Sep 17 00:00:00 2001 From: asraelite Date: Sun, 4 Mar 2018 16:49:42 +0000 Subject: [PATCH] Add start of ship editing --- dist/img/celestials/green_0.svg | 36 +++++---- dist/improcket.min.js.map | 2 +- js/consts.mjs | 14 +++- js/game/control.mjs | 34 ++++++++- js/game/edit.mjs | 10 +++ js/game/events.mjs | 26 +++++++ js/game/index.mjs | 6 ++ js/game/inventory.mjs | 0 js/game/player.mjs | 1 + js/graphics/background.mjs | 53 +++----------- js/graphics/index.mjs | 126 ++++++++++++++++++++++++++------ js/gui/button.mjs | 5 ++ js/gui/element.mjs | 12 ++- js/gui/index.mjs | 2 +- js/gui/misc.mjs | 5 +- js/gui/modules.mjs | 11 ++- js/world/celestial.mjs | 4 + js/world/ship.mjs | 41 ++++++++++- 18 files changed, 288 insertions(+), 100 deletions(-) create mode 100644 js/game/edit.mjs create mode 100644 js/game/inventory.mjs diff --git a/dist/img/celestials/green_0.svg b/dist/img/celestials/green_0.svg index 2d16b4b..1e4636d 100644 --- a/dist/img/celestials/green_0.svg +++ b/dist/img/celestials/green_0.svg @@ -9,9 +9,9 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="170.14249mm" - height="169.9458mm" - viewBox="0 0 170.14249 169.9458" + width="169.83333mm" + height="169.83333mm" + viewBox="0 0 169.83333 169.83333" version="1.1" id="svg8" inkscape:version="0.92.2 5c3e80d, 2017-08-06" @@ -28,9 +28,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="0.7" - inkscape:cx="451.52852" - inkscape:cy="229.53775" + inkscape:zoom="0.98994949" + inkscape:cx="333.2028" + inkscape:cy="366.87849" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="false" @@ -38,7 +38,15 @@ inkscape:window-height="714" inkscape:window-x="0" inkscape:window-y="0" - inkscape:window-maximized="1" /> + inkscape:window-maximized="1"> + + @@ -47,7 +55,7 @@ image/svg+xml - + @@ -55,7 +63,7 @@ inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" - transform="translate(24.791868,-146.70324)"> + transform="translate(25.041868,-147.06561)"> @@ -64,11 +72,11 @@ transform="translate(-2.2678571,1.5119048)" style="stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"> + inkscape:connector-curvature="0" /> diff --git a/dist/improcket.min.js.map b/dist/improcket.min.js.map index 8a905ba..3e6d83c 100644 --- a/dist/improcket.min.js.map +++ b/dist/improcket.min.js.map @@ -1 +1 @@ -{"version":3,"file":"improcket.min.js","sources":["../js/assets.mjs","../js/input.mjs","../js/gui/misc.mjs","../js/gui/element.mjs","../js/gui/frame.mjs","../js/gui/image.mjs","../js/gui/button.mjs","../js/consts.mjs","../js/world/module.mjs","../js/world/body.mjs","../js/world/particle.mjs","../js/world/ship.mjs","../js/world/celestial.mjs","../js/data.mjs","../js/world/spawn.mjs","../js/world/index.mjs","../js/game/player.mjs","../js/game/events.mjs","../js/gui/modules.mjs","../js/gui/index.mjs","../js/graphics/draw.mjs","../js/graphics/gui.mjs","../js/graphics/world.mjs","../js/graphics/background.mjs","../js/graphics/index.mjs","../js/game/control.mjs","../js/game/index.mjs","../js/index.mjs"],"sourcesContent":["export const images = {\n\ttitle: {\n\t\tlogo: 'logo.png',\n\t\tlogoSvg: 'logo2.svg'\n\t},\n\tbackground: {\n\t\tback: 'background.png',\n\t\tmiddle: 'stars_back.png',\n\t\tfront: 'stars_front.png'\n\t},\n\tmodules: {\n\t\tcapsule: {\n\t\t\tsmall: 'modules/small_capsule.svg'\n\t\t},\n\t\tfuel: {\n\t\t\tsmall: 'modules/small_fuel_tank.svg'\n\t\t},\n\t\tthruster: {\n\t\t\tlight: {\n\t\t\t\toff: 'modules/light_thruster.svg',\n\t\t\t\ton: 'modules/light_thruster_on.svg',\n\t\t\t}\n\t\t}\n\t},\n\tcelestials: {\n\t\tgreen: {\n\t\t\t\"0\": 'celestials/green_0.svg'\n\t\t}\n\t}\n};\n\nexport const audio = {};\n\nexport async function init() {\n\tlet parse = (obj, convert) => Object.entries(obj).forEach(([k, v]) => {\n\t\ttypeof v == 'object' ? parse(v, convert) : obj[k] = convert(v);\n\t});\n\n\tlet promises = [];\n\tparse(images, str => {\n\t\tlet img = new Image();\n\t\timg.src = 'img/' + str;\n\t\tpromises.push(new Promise((res, rej) => {\n\t\t\timg.addEventListener('load', res);\n\t\t}));\n\t\treturn img;\n\t});\n\tparse(audio, str => {\n\t\t// TODO: Load audio.\n\t});\n\n\tawait Promise.all(promises);\n}\n","import {canvas} from './graphics/index.mjs';\n\nexport const mouse = { pressed: {}, held: {}, x: 0, y: 0, scroll: 0 };\nexport const keyCode = { pressed: {}, held: {} };\nexport const key = { pressed: {}, held: {} };\nexport const action = {};\n\nconst mapping = {};\n\nexport function tick() {\n\tmouse.pressed = {};\n\tkeyCode.pressed = {};\n\tkey.pressed = {};\n\tmouse.scroll = 0;\n}\n\nexport function init() {\n\twindow.addEventListener('keydown', event => {\n\t\tkeyCode.pressed[event.code] = !keyCode.held[event.code];\n\t\tkeyCode.held[event.code] = true;\n\t\tkey.pressed[event.key] = !keyCode.held[event.key];\n\t\tkey.held[event.key] = true;\n\t});\n\n\twindow.addEventListener('keyup', event => {\n\t\tkeyCode.pressed[event.code] = false;\n\t\tkeyCode.held[event.code] = false;\n\t\tkey.pressed[event.key] = false;\n\t\tkey.held[event.key] = false;\n\t});\n\t// Ṕ͕͖ẖ̨’̖̺͓̪̹n̼͇͔̯̝̖g̙̩̭͕ͅͅl̻̰͘u͎̥͍̗ͅi̼̞̪̩͚̜͖ ̫̝̻͚͟m͎̳̙̭̩̩̕g̟̤̬̮l̫̕w̶͚͈͚̟͔’͖n͏̝͖̞̺ͅa͏̹͓̬̺f̗̬̬̬̖̫͜h͙̘̝̱̬̗͜ ̼͎͖C̱͔̱͖ṭ̬̱͖h̵̰̼̘̩ùlh̙́u̪̫ ̪̺̹̙̯R̞͓̹̞’͍͎͉͎̦͙ͅl͇̠̮y̙̪̰̪͙̖e̢̩͉͙̼h̗͔̹̳ ̶w̨̼͍̝̭̣̣ͅg̶̳̦̳a̴͉̹͙̭̟ͅh͈͎̞̜͉́’̼̜̠͞n̲a̯g̮͚͓̝l̠ ̹̹̱͙̝f̧̝͖̱h̪̟̻͖̖t͎͘aͅg̤̘͜n̶͈̻̻̝̳\n\twindow.addEventListener('mousedown', event => {\n\t\tmouse.pressed[event.button] = !mouse.held[event.button];\n\t\tmouse.held[event.button] = true;\n\t});\n\n\twindow.addEventListener('mouseup', event => {\n\t\tmouse.pressed[event.button] = false;\n\t\tmouse.held[event.button] = false;\n\t});\n\n\twindow.addEventListener('mousemove', event => {\n\t\tlet rect = canvas.getBoundingClientRect();\n\t\tmouse.x = event.clientX - rect.left;\n\t\tmouse.y = event.clientY - rect.top;\n\t});\n\n\twindow.addEventListener('wheel', event => {\n\t\tmouse.scroll = event.deltaY;\n\t});\n}\n","import * as input from '../input.mjs';\n\nexport class Rect {\n\tconstructor(x = 0, y = 0, w = 0, h = 0) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.w = w;\n\t\tthis.h = h;\n\n\t\tthis.onclick = null;\n\t\tthis.mouseHeld = false;\n\t}\n\n\ttickMouse() {\n\t\tif (this.mouseHeld == true && !input.mouse.held[0] && this.mouseOver)\n\t\t\tif (this.onclick !== null)\n\t\t\t\tthis.onclick();\n\t\tif (!this.mouseHeld && input.mouse.pressed[0] && this.mouseOver)\n\t\t\tthis.mouseHeld = true;\n\t\tif (!input.mouse.held[0])\n\t\t\tthis.mouseHeld = false;\n\t}\n\n\tget shape() {\n\t\treturn [this.x, this.y, this.w, this.h];\n\t}\n\n\tget center() {\n\t\treturn [this.x + this.w / 2, this.y + this.h / 2];\n\t}\n\n\tget mouseOver() {\n\t\treturn this.containsPoint(input.mouse.x, input.mouse.y);\n\t}\n\n\tget mouseClicked() {\n\t\treturn this.mouseOver() && input.mouse.pressed[0];\n\t}\n\n\tcontainsPoint(x, y) {\n\t\treturn x > this.x && x < this.x + this.w\n\t\t\t&& y > this.y && y < this.y + this.h;\n\t}\n}\n","import {Rect} from './misc.mjs';\n\nconst defaultOptions = {\n\tdraw: true // Whether the element itself will be rendered.\n}\n\nexport default class GuiElement extends Rect {\n\tconstructor(x, y, w, h, options = {}) {\n\t\tsuper(x, y, w, h);\n\t\tthis.children = new Set();\n\t\tthis.parent = null;\n\n\t\tthis.type = 'element';\n\n\t\tthis.options = Object.assign({}, defaultOptions, options);\n\t}\n\n\ttick() {\n\t\tthis.tickMouse();\n\t\tthis.children.forEach(c => c.tick());\n\t}\n\n\tappend(element) {\n\t\tthis.children.add(element);\n\t\telement.parent = this;\n\t}\n\n\tclear() {\n\t\tthis.children.clear();\n\t}\n\t// Code should be self-describing, comments are for fucking about.\n\t// - Albert Einstein\n\n\tposRelative({x = null, xc = 0, y = null, yc = 0, w = null, h = null}) {\n\t\tif (x !== null) {\n\t\t\tthis.x = (this.parent.w * x) - (this.w * xc);\n\t\t}\n\t\tif (y !== null)\n\t\t\tthis.y = (this.parent.h * y) - (this.h * yc);\n\t\tif (w !== null)\n\t\t\tthis.w = this.parent.w * w;\n\t\tif (h !== null)\n\t\t\tthis.h = this.parent.h * h;\n\t}\n}\n","import * as gui from './index.mjs';\nimport GuiElement from './element.mjs';\n\nexport default class GuiFrame extends GuiElement {\n\tconstructor(x, y, w, h, options) {\n\t\tsuper(x, y, w, h, options);\n\t\tthis.type = 'frame';\n\t}\n}\n","import * as gui from './index.mjs';\nimport GuiElement from './element.mjs';\n\nexport default class GuiImage extends GuiElement {\n\tconstructor(src, x, y, w, h) {\n\t\tw = w || src.width;\n\t\th = h || src.height;\n\t\tsuper(x, y, w, h);\n\t\tthis.type = 'image';\n\t\tthis.image = src;\n\t\tthis.imgRatio = src.width / src.height;\n\t}\n\n\tscaleImage({ w = null, h = null }) {\n\t\tif (w !== null && h === null) {\n\t\t\tthis.w = w;\n\t\t\tthis.h = w / this.imgRatio;\n\t\t} else if (h !== null && w === null) {\n\t\t\tthis.h = h;\n\t\t\tthis.w = h / this.imgRatio;\n\t\t} else if ( h !== null && w !== null) {\n\t\t\tthis.w = w;\n\t\t\tthis.h = h;\n\t\t}\n\t}\n}\n","import * as gui from './index.mjs';\nimport GuiElement from './element.mjs';\n\nexport default class GuiButton extends GuiElement {\n\tconstructor(text, onclick, x, y, w = 100, h = 30) {\n\t\tsuper(x, y, w, h);\n\t\tthis.type = 'button';\n\t\tthis.text = text;\n\t\tthis.onclick = onclick;\n\t}\n}\n","/*\n *\tConstants that do not change during gameplay.\n *\tThis can kind of be treated like a configuration file, I guess.\n *\n *\tAll le\n */\n\n// Unit length of sector. Only for internal representation.\nexport const SECTOR_SIZE = 512;\n// Star count per sector.\nexport const STAR_DENSITY = (SECTOR_SIZE ** 2) / 10000;\n// G, G-boy, The big G, Mr. G, g's big brother, G-dog\nexport const GRAVITATIONAL_CONSTANT = 0.01;\n// Perspective constraints. Higher zoom value = closer.\nexport const MIN_ZOOM = 1;\nexport const MAX_ZOOM = 100;\nexport const DEFAULT_ZOOM = 10;\nexport const ZOOM_SPEED = 0.01;\n","import {images as assets} from '../assets.mjs';\n\nexport default class Module {\n\tconstructor(x, y, ship, {\n\t\tname = 'Unnamed Module',\n\t\ttype = 'block',\n\t\tid = 'unknown',\n\t\tmass = 1,\n\t\t// Fuel\n\t\tfilled = false,\n\t\tfuelCapacity = 0,\n\t\t...properties\n\t}) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tthis.mass = mass;\n\t\tthis.ship = ship;\n\t\tthis.id = id;\n\t\tthis.images = assets.modules[this.type][this.id];\n\t\t// Fuel\n\t\tif (this.type == 'fuel') {\n\t\t\tthis.fuel = filled ? fuelCapacity : 0;\n\t\t} else if (this.type == 'thruster') {\n\t\t\tthis.power = 0;\n\t\t}\n\t}\n\n\treset() {\n\t\tif (this.type == 'thruster') {\n\t\t\tthis.power = 0;\n\t\t}\n\t}\n\n\tget com() {\n\t\treturn this.ship.getWorldPoint(...this.localCom);\n\t}\n\n\tget currentImage() {\n\t\tif (this.type == 'thruster') {\n\t\t\treturn this.power > 0 ? this.images.on : this.images.off;\n\t\t} else {\n\t\t\treturn this.images;\n\t\t}\n\t}\n\n\tget localCom() {\n\t\treturn [this.x + 0.5, this.y + 0.5];\n\t}\n}\n","import {GRAVITATIONAL_CONSTANT as G} from '../consts.mjs';\n\nexport default class Body {\n\tconstructor(x, y, mass) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.r = 0;\n\t\tthis.xvel = 0;\n\t\tthis.yvel = 0;\n\t\tthis.rvel = 0;\n\t\tthis.rfriction = 0.9;\n\t\tthis.mass = mass;\n\t}\n\n\tget com() {\n\t\treturn [this.x, this.y];\n\t}\n\n\tget pos() {\n\t\treturn [this.x, this.y];\n\t}\n\n\tget speed() {\n\t\treturn Math.sqrt(this.xvel ** 2 + this.yvel ** 2);\n\t}\n\n\tgetWorldPoint(lx, ly) {\n\t\tlet [cx, cy] = this.localCom;\n\t\tlet [nx, ny] = this.rotateVector(lx - cx, ly - cy, this.r);\n\t\treturn [nx + this.x + cx, ny + this.y + cy];\n\t}\n\n\tgetLocalPoint(wx, wy) {\n\t\tlet [lx, ly] = [wx - this.x, wy - this.y];\n\t\tlet [cx, cy] = this.localCom;\n\t\tlet [nx, ny] = this.rotateVector(lx, ly, -this.r);\n\t\treturn [nx - cx, ny - cy];\n\t}\n\n\trotateVector(x, y, r = this.r) {\n\t\treturn [(x * Math.cos(r) - y * Math.sin(r)),\n\t\t\t(y * Math.cos(r) - x * Math.sin(r))];\n\t}\n\n\trelativeVector(x, y) {\n\t\treturn this.rotateVector(x, y, this.r);\n\t}\n\n\ttickMotion() {\n\t\tthis.x += this.xvel;\n\t\tthis.y += this.yvel;\n\t\tthis.r += this.rvel;\n\t\tthis.rvel *= this.rfriction;\n\t}\n\n\ttickGravity(bodies) {\n\t\tbodies.forEach(b => {\n\t\t\tlet force = b.mass / this.mass / (this.distanceTo(b) ** 2) * G;\n\t\t\tlet [[ax, ay], [bx, by]] = [this.com, b.com];\n\t\t\tlet angle = Math.atan2(by - ay, bx - ax);\n\t\t\tthis.xvel += Math.cos(angle) * force;\n\t\t\tthis.yvel += Math.sin(angle) * force;\n\t\t});\n\t}\n\n\tdistanceTo(body) {\n\t\tlet [[ax, ay], [bx, by]] = [this.com, body.com];\n\t\treturn Math.max(Math.sqrt(((bx - ax) ** 2) +\n\t\t\t((by - ay) ** 2)), 1);\n\t}\n\n\tangleTo(ax, ay, bx, by) {\n\t\treturn Math.atan2(by - ay, bx - ax);\n\t}\n\n\tapproach(body, distance) {\n\t\tlet [[ax, ay], [bx, by]] = [this.com, body.com];\n\t\tlet angle = Math.atan2(by - ay, bx - ax);\n\t\tthis.x += Math.cos(angle) * distance;\n\t\tthis.y += Math.sin(angle) * distance;\n\t}\n\n\thalt() {\n\t\tthis.xvel = 0;\n\t\tthis.yvel = 0;\n\t}\n\n\tapplyDirectionalForce(x, y, r) {\n\t\tlet [vx, vy] = this.rotateVector(x, y);\n\t\tthis.xvel += vx;\n\t\tthis.yvel += vy;\n\t\tthis.rvel += r / this.mass;\n\t}\n}\n","import Body from './body.mjs';\nimport {celestials, particles} from './index.mjs';\n\nexport function createThrustExhaust(thruster) {\n\tlet ship = thruster.ship;\n\tlet [fx, fy] = ship.relativeVector(0, 0.2);\n\tlet [dx, dy] = ship.relativeVector((Math.random() - 0.5) * 0.5, 0.5);\n\tlet [cx, cy] = thruster.com;\n\tparticles.add(new Particle(cx + dx, cy + dy, {\n\t\txvel: ship.xvel + fx,\n\t\tyvel: ship.yvel + fy,\n\t\tcolor: '#f4c542',\n\t\tlifetime: 5,\n\t\tsize: 0.07\n\t}));\n}\n\nclass Particle extends Body {\n\tconstructor(x, y, {\n\t\txvel = 0,\n\t\tyvel = 0,\n\t\tspray = 0.1,\n\t\tfizzle = 0,\n\t\tmaxFizzle = fizzle * 2,\n\t\tcolor = '#fff',\n\t\tgravity = false,\n\t\tlifetime = 50,\n\t\tsize = 0.1,\n\t\tfriction = 0.99\n\t}) {\n\t\tsuper(x, y, 0.1);\n\n\t\tthis.size = size;\n\t\tthis.xvel = xvel + (Math.random() - 0.5) * spray;\n\t\tthis.yvel = yvel + (Math.random() - 0.5) * spray;\n\t\tthis.friction = friction;\n\t\tthis.fizzle = fizzle;\n\t\tthis.maxFizzle = maxFizzle;\n\t\tthis.color = color;\n\t\tthis.gravity = gravity;\n\t\tthis.life = lifetime;\n\t}\n\n\tget com() {\n\t\treturn [this.x - this.size / 2, this.y - this.size / 2];\n\t}\n\n\ttick() {\n\t\tif (!this.life--) {\n\t\t\tparticles.delete(this);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.tickMotion();\n\t\tif (this.gravity) this.tickGravity(celestials);\n\n\t\tthis.xvel *= this.friction;\n\t\tthis.yvel *= this.friction;\n\t\tthis.x += (Math.random() - 0.5) * this.fizzle;\n\t\tthis.y += (Math.random() - 0.5) * this.fizzle;\n\t\tif (this.fizzle < this.mazFizzle) this.fizzle *= 1.05;\n\t}\n}\n","import Module from './module.mjs';\nimport Body from './body.mjs';\nimport * as world from './index.mjs';\nimport * as particle from './particle.mjs';\n\nexport default class Ship extends Body {\n\tconstructor(x, y) {\n\t\tsuper(x, y, 0);\n\n\t\tthis.localCom = [0, 0];\n\t\tthis.modules = new Set();\n\t\tthis.maxRadius = 0;\n\t}\n\n\tget com() {\n\t\tlet [lx, ly] = this.localCom;\n\t\treturn [this.x + lx, this.y + ly];\n\t}\n\n\ttick() {\n\t\tthis.tickMotion();\n\t\tthis.tickGravity(world.celestials);\n\t\tthis.resolveCollisions();\n\n\t\tthis.modules.forEach(m => {\n\t\t\tif (m.type == 'thruster' && m.power !== 0) {\n\t\t\t\tfor (let i = 0; i < 2; i++) particle.createThrustExhaust(m);\n\t\t\t}\n\t\t});\n\n\t\tthis.modules.forEach(m => m.reset());\n\t}\n\n\taddModule(x, y, properties, options) {\n\t\tlet module = new Module(x, y, this, {...properties, ...options});\n\t\tthis.modules.add(module);\n\t\tthis.refreshShape();\n\t}\n\n\tdeleteModule(module) {\n\t\tthis.modules.delete(module);\n\t\tthis.refreshShape();\n\t}\n\n\trefreshShape() {\n\t\tlet points = [];\n\t\tthis.modules.forEach(m => points.push([...m.localCom, m.mass]));\n\t\tthis.mass = points.reduce((a, [,,b]) => a + b, 0);\n\t\tthis.localCom = points.reduce(([ax, ay], [bx, by, bm]) =>\n\t\t\t[ax + bx * bm, ay + by * bm], [0, 0])\n\t\t\t.map(x => x / this.mass);\n\t\tlet [lx, ly] = this.localCom;\n\t\tthis.maxRadius = points.reduce((a, [bx, by]) =>\n\t\t\tMath.max(Math.sqrt((bx - lx) ** 2 + (by - ly) ** 2), a), 0) + 1;\n\t}\n\n\tresolveCollisions() {\n\t\tworld.celestials.forEach(c => {\n\t\t\tlet dis = this.distanceTo(c);\n\n\t\t\tif (dis < c.radius + this.maxRadius) {\n\t\t\t\tthis.modules.forEach(m => {\n\t\t\t\t\tthis.checkModuleCollision(m, c);\n\t\t\t\t});\n\t\t\t}\n\t\t})\n\t}\n\n\tresolveCelestialCollision(pos, cel) {\n\t\t//debugger;\n\t\tlet theta = this.angleTo(...this.com, ...cel.com);\n\t\tlet angleToCom = this.angleTo(...this.com, ...pos);\n\t\tlet angle = angleToCom - theta;\n\t\tlet [force] = this.rotateVector(0, 1, angle);\n\t\tif (Math.abs(angle) < 0.3) {\n\t\t\tforce *= -1;\n\t\t}\n\t\tthis.rvel -= force * 0.015;\n\t}\n\n\tcheckModuleCollision(module, body) {\n\t\tlet p = this.getWorldPoint(...module.localCom);\n\t\tlet dis = body.distanceTo({ com: p });\n\t\tif (dis < body.radius + 0.5) {\n\t\t\tthis.approach(body, dis - (body.radius + 0.5));\n\t\t\tthis.halt();\n\t\t\tthis.resolveCelestialCollision(p, body);\n\t\t}\n\t}\n\n\tapplyThrust({ forward = 0, left = 0, right = 0, back = 0,\n\t\tturnLeft = 0, turnRight = 0}) {\n\t\tlet turnForce = (turnRight - turnLeft) / 20;\n\t\tthis.applyDirectionalForce(0, -forward / 30, turnForce);\n\n\t\tthis.modules.forEach(m => {\n\t\t\tif (m.type !== 'thruster') return;\n\t\t\tm.power = forward;\n\t\t});\n\n\t}\n}\n","import {images as assets} from '../assets.mjs';\nimport Body from './body.mjs';\n\nexport default class Celestial extends Body {\n\tconstructor(x, y, radius, {\n\t\tdensity = 1,\n\t\ttype = 'rock'\n\t}) {\n\t\tlet mass = (radius ** 2) * density\n\t\tsuper(x, y, mass);\n\t\tthis.radius = radius;\n\n\t\tthis.type = type;\n\t\tlet imageArr = Object.values(assets.celestials[this.type]);\n\t\tthis.image = imageArr[Math.random() * imageArr.length | 0];\n\t}\n\n\tget com() {\n\t\treturn [this.x + this.radius, this.y + this.radius];\n\t}\n\n\ttick() {\n\n\t}\n\n\tget diameter() {\n\t\treturn this.radius * 2;\n\t}\n}\n","export const modules = {\n\tcapsule: {\n\t\tsmall: {\n\t\t\tname: 'Small Capsule',\n\t\t\ttooltip: 'A small, simple capsule. Provides just enough ' +\n\t\t\t\t'rotational power for a small rocket.',\n\t\t\ttype: 'capsule',\n\t\t\tid: 'small',\n\t\t\tmass: 2,\n\t\t\trotation: 0.1\n\t\t}\n\t},\n\tfuel: {\n\t\tsmall: {\n\t\t\tname: 'Small Fuel Tank',\n\t\t\ttooltip: 'A small flimsy tank with enough fuel for a short trip.',\n\t\t\ttype: 'fuel',\n\t\t\tid: 'small',\n\t\t\tmass: 1,\n\t\t\tcapacity: 3\n\t\t}\n\t},\n\tthruster: {\n\t\tlight: {\n\t\t\tname: 'Light Main Thruster',\n\t\t\ttooltip: 'Powerful enough to lift a small ship, but not much ' +\n\t\t\t\t'more. Not very efficient.',\n\t\t\ttype: 'thruster',\n\t\t\tid: 'light',\n\t\t\tmass: 2,\n\t\t\tthrust: 10,\n\t\t\tisp: 200\n\t\t}\n\t}\n}\n","import Ship from './ship.mjs';\nimport Module from './module.mjs';\nimport Celestial from './celestial.mjs';\nimport {modules} from '../data.mjs';\nimport * as world from './index.mjs';\n\nexport function player() {\n\tlet ship = new Ship(0, -45);\n\tship.addModule(0, 0, modules.capsule.small);\n\tship.addModule(0, 1, modules.fuel.small, { filled: true });\n\tship.addModule(0, 2, modules.thruster.light);\n\tworld.ships.add(ship);\n\tworld.setPlayerShip(ship);\n\treturn ship;\n}\n\nexport function startPlanet() {\n\treturn celestial(0, 0, 40, {\n\t\tdensity: 10,\n\t\ttype: 'green'\n\t});\n}\n\nexport function celestial(x, y, radius, params) {\n\tlet celestial = new Celestial(x - radius, y - radius, radius, params);\n\tworld.celestials.add(celestial);\n\treturn celestial;\n}\n","import * as sector from './sector.mjs';\nimport * as spawn from './spawn.mjs';\n\nexport {getSectorFromWorld, getContainedSectors} from './sector.mjs';\n\nexport const entities = new Set();\nexport const celestials = new Set();\nexport const ships = new Set();\nexport const particles = new Set();\n\nexport let playerShip = null;\n\nexport function setPlayerShip(ship) {\n\tplayerShip = ship;\n}\n\nexport function init() {\n\tentities.clear();\n\tcelestials.clear();\n\tships.clear();\n\tparticles.clear();\n\tspawn.player();\n\tspawn.startPlanet();\n}\n\nexport function tick() {\n\tparticles.forEach(p => p.tick());\n\tcelestials.forEach(c => c.tick());\n\tentities.forEach(e => e.tick());\n\tships.forEach(s => s.tick());\n}\n","import * as world from '../world/index.mjs';\n\nexport let ship;\n\nexport function init() {\n\tship = world.playerShip;\n}\n","import * as game from './index.mjs';\nimport * as graphics from '../graphics/index.mjs';\nimport * as world from '../world/index.mjs';\nimport * as player from './player.mjs';\n\nexport function startGame() {\n\tgame.changeView('game');\n\tgraphics.perspective.focusPlayer();\n}\n","import * as gui from './index.mjs';\nimport {images as assets} from '../assets.mjs';\nimport {canvas} from '../graphics/index.mjs';\nimport GuiFrame from './frame.mjs';\nimport GuiImage from './image.mjs';\nimport GuiButton from './button.mjs';\nimport * as events from '../game/events.mjs';\n\nexport function root() {\n\treturn new GuiFrame(0, 0, canvas.width, canvas.height, {\n\t\tdraw: false\n\t});\n}\n\nexport function title() {\n\tlet shadow = root();\n\tlet logo = new GuiImage(assets.title.logo);\n\tshadow.append(logo);\n\tlogo.scaleImage({ w: shadow.w * 0.7 });\n\tlogo.posRelative({ x: 0.5, xc: 0.5, y: 0.2 });\n\n\t// TODO: Implement call to change view to game.\n\tlet startFunction = events.startGame;\n\tlet start = new GuiButton('Start game', events.startGame, 0, 0, 200);\n\tshadow.append(start);\n\tstart.posRelative({ x: 0.5, xc: 0.5, y: 0.7 });\n\n\tlet secondFunction = () => {};\n\tlet second = new GuiButton('Don\\'t start game', secondFunction, 0, 0, 200);\n\tshadow.append(second);\n\tsecond.posRelative({ x: 0.5, xc: 0.5, y: 0.7 });\n\tsecond.y += 60;\n\n\treturn shadow;\n}\n\nexport function game() {\n\tlet shadow = root();\n\t\n\treturn shadow;\n}\n","import {context} from '../graphics/index.mjs';\nimport * as modules from './modules.mjs';\n\nexport const elements = new Set();\nexport let root;\n\nexport function init() {\n\telements.clear();\n\troot = modules.root();\n\tchangeView('title');\n}\n\nexport function tick() {\n\troot.tick();\n}\n\nexport function changeView(view) {\n\troot.clear();\n\n\tif (view == 'title') {\n\t\troot.append(modules.title());\n\t}\n\n\tif (view == 'game') {\n\t\troot.append(modules.game());\n\t}\n}\n\nexport function measureText(msg, font) {\n\tcontext.font = font;\n\tlet measurement = context.measureText(msg);\n\treturn [measurement.width, measurement.height];\n}\n","import {canvas, context} from './index.mjs';\n\nexport function text(string, x, y,\n\t{font = '52pt Arial', align = 'left', valign = 'top', color = null}) {\n\tcontext.textAlign = align;\n\tcontext.textBaseline = valign;\n\tcontext.fillStyle = color === null ? context.fillStyle : color;\n\tcontext.font = font;\n\n\tcontext.fillText(string, x, y);\n}\n","import {canvas, context} from './index.mjs';\nimport * as gui from '../gui/index.mjs';\nimport * as draw from './draw.mjs';\n\nexport function render() {\n\trenderElement(gui.root);\n}\n\nfunction renderElement(element) {\n\t//console.log(element.options);\n\tif (element.options.draw) {\n\t\tif (element.type == 'frame') renderFrame(element);\n\t\tif (element.type == 'image') renderImage(element);\n\t\tif (element.type == 'button') renderButton(element);\n\t}\n\telement.children.forEach(renderElement);\n}\n\nfunction renderFrame(element) {\n\tcontext.fillStyle = '#eb9';\n\tcontext.fillRect(...element.shape);\n}\n\nfunction renderImage(element) {\n\tcontext.drawImage(element.image, ...element.shape);\n}\n\nfunction renderButton(element) {\n\tif (element.mouseHeld) {\n\t\tcontext.fillStyle = '#706244';\n\t} else {\n\t\tcontext.fillStyle = element.mouseOver ? '#ad9869' : '#917f58';\n\t}\n\t\n\tcontext.fillRect(...element.shape);\n\tcontext.strokeStyle = '#541';\n\tcontext.strokeWidth = 4;\n\tcontext.strokeRect(...element.shape);\n\tcontext.textAlign = 'center';\n\tcontext.textBaseline = 'middle';\n\tcontext.fillStyle = '#fff';\n\tcontext.font = '12pt Consolas';\n\tcontext.fillText(element.text, ...element.center);\n}\n","import {canvas, context} from './index.mjs';\nimport {images as assets} from '../assets.mjs';\nimport * as world from '../world/index.mjs';\n\nexport function render() {\n\tworld.particles.forEach(renderParticle);\n\tworld.celestials.forEach(renderCelestial);\n\tworld.ships.forEach(renderShip);\n}\n\nfunction renderParticle(particle) {\n\tcontext.fillStyle = particle.color;\n\tcontext.fillRect(...particle.com, particle.size, particle.size);\n}\n\nfunction renderShip(ship) {\n\tcontext.save();\n\tcontext.translate(...ship.com);\n\tcontext.rotate(ship.r);\n\tlet [cx, cy] = ship.localCom;\n\tcontext.translate(-cx, -cy);\n\tship.modules.forEach(m => {\n\t\tcontext.drawImage(m.currentImage, m.x, m.y, 1, 1);\n\t});\n\tcontext.restore();\n}\n\nconst celestialImages = {\n\tgreen: Object.values(assets.celestials.green)\n}\n\nfunction renderCelestial(cel) {\n\tcontext.drawImage(cel.image, cel.x, cel.y,\n\t\tcel.diameter, cel.diameter);\n}\n","import {canvas, context, perspective} from './index.mjs';\nimport {images as assets} from '../assets.mjs';\n\nlet patterns = null;\n\nfunction init() {\n\tpatterns = {\n\t\tback: context.createPattern(assets.background.back, 'repeat'),\n\t\tmiddle: context.createPattern(assets.background.middle, 'repeat'),\n\t\tfront: context.createPattern(assets.background.front, 'repeat')\n\t};\n}\n\nexport function render() {\n\tif (patterns === null) init();\n\n\trenderLayer(patterns.back, 0.3, 1);\n\trenderLayer(patterns.middle, 0.5, 0.3);\n\t//renderLayer(patterns.front, 0.7, 0.3);\n}\n\nfunction renderLayer(pattern, speed = 1, scale = 1) {\n\tcontext.save();\n\tlet [px, py] = [perspective.x * speed, perspective.y * speed];\n\tcontext.translate(-px, -py);\n\tcontext.scale(scale, scale);\n\tcontext.fillStyle = pattern;\n\tcontext.fillRect(px / scale, py / scale,\n\t\tcanvas.width / scale, canvas.height / scale);\n\tcontext.restore();\n}\n\n/*\nfunction renderSectorStars(sector) {\n\tlet rand = new SeededRandom(sector.numId);\n\n\tcontext.fillStyle = '#fff';\n\n\tfor (let i = 0; i < STAR_DENSITY; i++) {\n\t\tlet sx = rand.next() * sector.size + sector.wx;\n\t\tlet sy = rand.next() * sector.size + sector.wy;\n\t\tcontext.fillRect(sx, sy, 1.5, 1.5);\n\t}\n}\n\nfunction tile(img, x, y, dx = 0, dy = 0, scale = 1) {\n\tlet [sx, sy] = [x * scale, y * scale];\n\tlet [ex, ey] = [(x + canvas.width) * scale, (y + canvas.height) * scale];\n\tfor (let x = sx; x < ex;) {\n\t\tlet nx = (Math.floor(x / img.width) + 1) * img.width;\n\t\tnx = Math.min(nx, ex);\n\t\tlet w = nx - x;\n\n\t\tfor (let y = sy; y < ey;) {\n\t\t\tlet ny = (Math.floor(y / img.height) + 1) * img.height;\n\t\t\tny = Math.min(ny, ey);\n\t\t\tlet h = ny - y;\n\n\t\t\tcontext.drawImage(img, x % img.width, y % img.height, w, h,\n\t\t\t\tdx + x, dy + y, w, h);\n\n\t\t\ty = ny;\n\t\t}\n\n\t\tx = nx;\n\t}\n}\n*/\n","import * as gui from './gui.mjs';\nimport * as draw from './draw.mjs';\nimport * as input from '../input.mjs';\nimport {render as renderWorld} from './world.mjs';\nimport {render as renderBackground} from './background.mjs';\nimport * as world from '../world/index.mjs';\nimport * as consts from '../consts.mjs';\n\nexport let canvas, context, tempCanvas, tempContext;\nexport let perspective;\n\nexport function init() {\n\tcanvas = document.querySelector('#main');\n\tcontext = canvas.getContext('2d');\n\ttempCanvas = document.querySelector('#temp');\n\ttempContext = tempCanvas.getContext('2d');\n\n\tcanvas.width = 600;\n\tcanvas.height = 600;\n\n\tperspective = new Perspective();\n\n\tdraw.text('Loading...', canvas.width / 2, canvas.height / 2,\n\t\t{ align: 'center', valign: 'middle' });\n}\n\nexport function render() {\n\tcontext.clearRect(0, 0, canvas.width, canvas.height);\n\tcontext.fillStyle = '#000';\n\tcontext.fillRect(0, 0, canvas.width, canvas.height);\n\n\trenderBackground();\n\n\tcontext.save();\n\tperspective.tick();\n\tperspective.transformCanvas();\n\trenderWorld();\n\tcontext.restore();\n\n\tgui.render();\n}\n\nexport function getVisibleSectors() {\n\treturn world.getContainedSectors(...perspective.bounds);\n}\n\nclass Perspective {\n\tconstructor() {\n\t\tthis.x = 0;\n\t\tthis.y = 0;\n\t\tthis.bounds = [0, 0, canvas.width, canvas.height];\n\t\tthis.reset();\n\t}\n\n\ttick() {\n\t\tif (input.mouse.scroll !== 0) {\n\t\t\tthis.zoomDelta(-input.mouse.scroll);\n\t\t}\n\n\t\tif (this.focus !== null) {\n\t\t\t[this.x, this.y] = this.focus.com;\n\t\t}\n\n\t\tif (this.rotationFocus !== null) {\n\t\t\tthis.targetRotation = this.rotationFocus.r;\n\t\t} else {\n\t\t\tthis.targetRotation = 0;\n\t\t}\n\n\t\tif (this.smoothRotation) {\n\t\t\tthis.rotation = (this.rotation * 0.9 + this.targetRotation * 0.1);\n\t\t} else {\n\t\t\tthis.rotation = this.targetRotation;\n\t\t}\n\t}\n\n\treset() {\n\t\tthis.rotation = 0;\n\t\tthis.targetRotation = 0;\n\t\tthis.smoothRotation = false;\n\t\tthis.zoom = consts.DEFAULT_ZOOM;\n\t\tthis.focus = null;\n\t\tthis.rotationFocus = null;\n\t}\n\n\tfocusPlayer() {\n\t\tthis.focus = world.playerShip;\n\t\tthis.rotationFocus = world.playerShip;\n\t\tthis.smoothRotation = false;\n\t}\n\n\tzoomDelta(delta) {\n\t\tlet factor = 1 + (consts.ZOOM_SPEED * Math.abs(delta));\n\t\tthis.zoom *= delta > 0 ? factor : 1 / factor;\n\t\tthis.normalize();\n\t}\n\n\tnormalize() {\n\t\tthis.zoom = Math.max(consts.MIN_ZOOM,\n\t\t\tMath.min(consts.MAX_ZOOM, this.zoom));\n\t}\n\n\ttransformCanvas() {\n\t\tlet [,,bw, bh] = this.bounds;\n\t\tlet tx = -this.x * this.zoom;\n\t\tlet ty = -this.y * this.zoom;\n\t\tcontext.translate(tx + bw / 2, ty + bh / 2);\n\t\tcontext.scale(this.zoom, this.zoom);\n\t}\n}\n","import * as input from '../input.mjs';\nimport * as player from './player.mjs';\n\nexport const mapping = {\n\tthrust: 'KeyW',\n\tleft: 'KeyA',\n\tright: 'KeyD'\n};\n\nexport function tick() {\n\tlet held = input.keyCode.held;\n\tlet pressed = input.keyCode.pressed;\n\n\tif (held[mapping.thrust]) {\n\t\tplayer.ship.applyThrust({ forward: 1 });\n\t}\n\n\tif (held[mapping.left]) {\n\t\tplayer.ship.applyThrust({ turnLeft: 1 });\n\t}\n\n\tif (held[mapping.right]) {\n\t\tplayer.ship.applyThrust({ turnRight: 1 });\n\t}\n}\n","import * as graphics from '../graphics/index.mjs';\nimport * as gui from '../gui/index.mjs';\nimport * as assets from '../assets.mjs';\nimport * as input from '../input.mjs';\nimport * as world from '../world/index.mjs';\nimport * as events from './events.mjs';\nimport * as control from './control.mjs';\nimport * as player from './player.mjs';\n\nexport let state;\n\nexport async function init() {\n\tstate = {\n\t\tview: 'menu',\n\t\tpaused: false\n\t};\n\n\tgraphics.init();\n\tawait assets.init();\n\tgui.init();\n\tinput.init();\n\n\t//events.startGame();\n\n\t//tick(); return;\n\n\t// Recursive `requestAnimationFrame` can cause problems with Parcel.\n\twhile(true) {\n\t\tawait tick();\n\t\tawait new Promise(res => requestAnimationFrame(res));\n\t}\n}\n\nexport function changeView(view) {\n\tstate.view = view;\n\tgui.changeView(view);\n\n\tif (view == 'game') {\n\t\tworld.init();\n\t\tplayer.init();\n\t}\n}\n\nasync function tick() {\n\tif (state.view == 'game') {\n\t\tworld.tick();\n\t\tcontrol.tick();\n\t}\n\n\tgui.tick();\n\tgraphics.render();\n\tinput.tick();\n}\n","import { init } from './game/index.mjs';\n\nwindow.addEventListener('load', init);\n"],"names":["init","input.mouse","assets","G","world.celestials","particle.createThrustExhaust","world.ships","world.setPlayerShip","spawn.player","spawn.startPlanet","tick","world.playerShip","game.changeView","graphics.perspective","events.startGame","root","modules.root","modules.title","modules.game","gui.root","render","world.particles","draw.text","renderBackground","renderWorld","gui.render","consts.DEFAULT_ZOOM","consts.ZOOM_SPEED","consts.MIN_ZOOM","consts.MAX_ZOOM","mapping","input.keyCode","player.ship","graphics.init","assets.init","gui.init","input.init","changeView","gui.changeView","world.init","player.init","world.tick","control.tick","gui.tick","graphics.render","input.tick"],"mappings":"AAAO,MAAM,MAAM,GAAG;CACrB,KAAK,EAAE;EACN,IAAI,EAAE,UAAU;EAChB,OAAO,EAAE,WAAW;EACpB;CACD,UAAU,EAAE;EACX,IAAI,EAAE,gBAAgB;EACtB,MAAM,EAAE,gBAAgB;EACxB,KAAK,EAAE,iBAAiB;EACxB;CACD,OAAO,EAAE;EACR,OAAO,EAAE;GACR,KAAK,EAAE,2BAA2B;GAClC;EACD,IAAI,EAAE;GACL,KAAK,EAAE,6BAA6B;GACpC;EACD,QAAQ,EAAE;GACT,KAAK,EAAE;IACN,GAAG,EAAE,4BAA4B;IACjC,EAAE,EAAE,+BAA+B;IACnC;GACD;EACD;CACD,UAAU,EAAE;EACX,KAAK,EAAE;GACN,GAAG,EAAE,wBAAwB;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,MAAM,EAAE,KAAK;EACb,CAAC;;CAEFiC,MAAa,EAAE,CAAC;CAChB,MAAMC,IAAW,EAAE,CAAC;CACpBC,MAAQ,EAAE,CAAC;CACXC,MAAU,EAAE,CAAC;;;;;;;CAOb,MAAM,IAAI,EAAE;EACX,MAAM1B,MAAI,EAAE,CAAC;EACb,MAAM,IAAI,OAAO,CAAC,GAAG,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC;EACrD;CACD;;AAED,AAAO,SAAS2B,YAAU,CAAC,IAAI,EAAE;CAChC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;CAClBC,UAAc,CAAC,IAAI,CAAC,CAAC;;CAErB,IAAI,IAAI,IAAI,MAAM,EAAE;EACnBC,MAAU,EAAE,CAAC;EACbC,MAAW,EAAE,CAAC;EACd;CACD;;AAED,eAAe9B,MAAI,GAAG;CACrB,IAAI,KAAK,CAAC,IAAI,IAAI,MAAM,EAAE;EACzB+B,MAAU,EAAE,CAAC;EACbC,MAAY,EAAE,CAAC;EACf;;CAEDC,MAAQ,EAAE,CAAC;CACXC,QAAe,EAAE,CAAC;CAClBC,IAAU,EAAE,CAAC;CACb;;AClDD,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE7C,MAAI,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"improcket.min.js","sources":["../js/assets.mjs","../js/input.mjs","../js/gui/misc.mjs","../js/gui/element.mjs","../js/gui/frame.mjs","../js/gui/image.mjs","../js/gui/button.mjs","../js/consts.mjs","../js/world/module.mjs","../js/world/body.mjs","../js/world/particle.mjs","../js/world/ship.mjs","../js/world/celestial.mjs","../js/data.mjs","../js/world/spawn.mjs","../js/world/index.mjs","../js/game/player.mjs","../js/game/edit.mjs","../js/game/events.mjs","../js/gui/modules.mjs","../js/gui/index.mjs","../js/graphics/draw.mjs","../js/graphics/gui.mjs","../js/graphics/world.mjs","../js/graphics/background.mjs","../js/graphics/index.mjs","../js/game/control.mjs","../js/game/index.mjs","../js/index.mjs"],"sourcesContent":["export const images = {\n\ttitle: {\n\t\tlogo: 'logo.png',\n\t\tlogoSvg: 'logo2.svg'\n\t},\n\tbackground: {\n\t\tback: 'background.png',\n\t\tmiddle: 'stars_back.png',\n\t\tfront: 'stars_front.png'\n\t},\n\tmodules: {\n\t\tcapsule: {\n\t\t\tsmall: 'modules/small_capsule.svg'\n\t\t},\n\t\tfuel: {\n\t\t\tsmall: 'modules/small_fuel_tank.svg'\n\t\t},\n\t\tthruster: {\n\t\t\tlight: {\n\t\t\t\toff: 'modules/light_thruster.svg',\n\t\t\t\ton: 'modules/light_thruster_on.svg',\n\t\t\t}\n\t\t}\n\t},\n\tcelestials: {\n\t\tgreen: {\n\t\t\t\"0\": 'celestials/green_0.svg'\n\t\t}\n\t}\n};\n\nexport const audio = {};\n\nexport async function init() {\n\tlet parse = (obj, convert) => Object.entries(obj).forEach(([k, v]) => {\n\t\ttypeof v == 'object' ? parse(v, convert) : obj[k] = convert(v);\n\t});\n\n\tlet promises = [];\n\tparse(images, str => {\n\t\tlet img = new Image();\n\t\timg.src = 'img/' + str;\n\t\tpromises.push(new Promise((res, rej) => {\n\t\t\timg.addEventListener('load', res);\n\t\t}));\n\t\treturn img;\n\t});\n\tparse(audio, str => {\n\t\t// TODO: Load audio.\n\t});\n\n\tawait Promise.all(promises);\n}\n","import {canvas} from './graphics/index.mjs';\n\nexport const mouse = { pressed: {}, held: {}, x: 0, y: 0, scroll: 0 };\nexport const keyCode = { pressed: {}, held: {} };\nexport const key = { pressed: {}, held: {} };\nexport const action = {};\n\nconst mapping = {};\n\nexport function tick() {\n\tmouse.pressed = {};\n\tkeyCode.pressed = {};\n\tkey.pressed = {};\n\tmouse.scroll = 0;\n}\n\nexport function init() {\n\twindow.addEventListener('keydown', event => {\n\t\tkeyCode.pressed[event.code] = !keyCode.held[event.code];\n\t\tkeyCode.held[event.code] = true;\n\t\tkey.pressed[event.key] = !keyCode.held[event.key];\n\t\tkey.held[event.key] = true;\n\t});\n\n\twindow.addEventListener('keyup', event => {\n\t\tkeyCode.pressed[event.code] = false;\n\t\tkeyCode.held[event.code] = false;\n\t\tkey.pressed[event.key] = false;\n\t\tkey.held[event.key] = false;\n\t});\n\t// Ṕ͕͖ẖ̨’̖̺͓̪̹n̼͇͔̯̝̖g̙̩̭͕ͅͅl̻̰͘u͎̥͍̗ͅi̼̞̪̩͚̜͖ ̫̝̻͚͟m͎̳̙̭̩̩̕g̟̤̬̮l̫̕w̶͚͈͚̟͔’͖n͏̝͖̞̺ͅa͏̹͓̬̺f̗̬̬̬̖̫͜h͙̘̝̱̬̗͜ ̼͎͖C̱͔̱͖ṭ̬̱͖h̵̰̼̘̩ùlh̙́u̪̫ ̪̺̹̙̯R̞͓̹̞’͍͎͉͎̦͙ͅl͇̠̮y̙̪̰̪͙̖e̢̩͉͙̼h̗͔̹̳ ̶w̨̼͍̝̭̣̣ͅg̶̳̦̳a̴͉̹͙̭̟ͅh͈͎̞̜͉́’̼̜̠͞n̲a̯g̮͚͓̝l̠ ̹̹̱͙̝f̧̝͖̱h̪̟̻͖̖t͎͘aͅg̤̘͜n̶͈̻̻̝̳\n\twindow.addEventListener('mousedown', event => {\n\t\tmouse.pressed[event.button] = !mouse.held[event.button];\n\t\tmouse.held[event.button] = true;\n\t});\n\n\twindow.addEventListener('mouseup', event => {\n\t\tmouse.pressed[event.button] = false;\n\t\tmouse.held[event.button] = false;\n\t});\n\n\twindow.addEventListener('mousemove', event => {\n\t\tlet rect = canvas.getBoundingClientRect();\n\t\tmouse.x = event.clientX - rect.left;\n\t\tmouse.y = event.clientY - rect.top;\n\t});\n\n\twindow.addEventListener('wheel', event => {\n\t\tmouse.scroll = event.deltaY;\n\t});\n}\n","import * as input from '../input.mjs';\n\nexport class Rect {\n\tconstructor(x = 0, y = 0, w = 0, h = 0) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.w = w;\n\t\tthis.h = h;\n\n\t\tthis.onclick = null;\n\t\tthis.mouseHeld = false;\n\t}\n\n\tclick() {}\n\n\ttickMouse() {\n\t\tif (this.mouseHeld == true && !input.mouse.held[0] && this.mouseOver)\n\t\t\tthis.click();\n\t\tif (!this.mouseHeld && input.mouse.pressed[0] && this.mouseOver)\n\t\t\tthis.mouseHeld = true;\n\t\tif (!input.mouse.held[0])\n\t\t\tthis.mouseHeld = false;\n\t}\n\n\tget shape() {\n\t\treturn [this.x, this.y, this.w, this.h];\n\t}\n\n\tget center() {\n\t\treturn [this.x + this.w / 2, this.y + this.h / 2];\n\t}\n\n\tget mouseOver() {\n\t\treturn this.containsPoint(input.mouse.x, input.mouse.y);\n\t}\n\n\tget mouseClicked() {\n\t\treturn this.mouseOver() && input.mouse.pressed[0];\n\t}\n\n\tcontainsPoint(x, y) {\n\t\treturn x > this.x && x < this.x + this.w\n\t\t\t&& y > this.y && y < this.y + this.h;\n\t}\n}\n","import {Rect} from './misc.mjs';\n\nconst defaultOptions = {\n\tdraw: true, // Whether the element itself will be rendered.\n\tdrawChildren: true // Whether children will be rendered.\n}\n\nexport default class GuiElement extends Rect {\n\tconstructor(x, y, w, h, options = {}) {\n\t\tsuper(x, y, w, h);\n\t\tthis.children = new Set();\n\t\tthis.parent = null;\n\n\t\tthis.type = 'element';\n\n\t\tthis.options = Object.assign({}, defaultOptions, options);\n\t}\n\n\ttickElement() {\n\t\tthis.tickMouse();\n\t\tthis.tick();\n\t\tthis.children.forEach(c => c.tickElement());\n\t}\n\n\ttick() {\n\n\t}\n\n\tappend(element) {\n\t\tthis.children.add(element);\n\t\telement.parent = this;\n\t}\n\n\tclear() {\n\t\tthis.children.clear();\n\t}\n\t// Code should be self-describing, comments are for fucking about.\n\t// - Albert Einstein\n\n\tposRelative({x = null, xc = 0, y = null, yc = 0, w = null, h = null}) {\n\t\tif (x !== null) {\n\t\t\tthis.x = (this.parent.w * x) - (this.w * xc);\n\t\t}\n\t\tif (y !== null)\n\t\t\tthis.y = (this.parent.h * y) - (this.h * yc);\n\t\tif (w !== null)\n\t\t\tthis.w = this.parent.w * w;\n\t\tif (h !== null)\n\t\t\tthis.h = this.parent.h * h;\n\t}\n}\n","import * as gui from './index.mjs';\nimport GuiElement from './element.mjs';\n\nexport default class GuiFrame extends GuiElement {\n\tconstructor(x, y, w, h, options) {\n\t\tsuper(x, y, w, h, options);\n\t\tthis.type = 'frame';\n\t}\n}\n","import * as gui from './index.mjs';\nimport GuiElement from './element.mjs';\n\nexport default class GuiImage extends GuiElement {\n\tconstructor(src, x, y, w, h) {\n\t\tw = w || src.width;\n\t\th = h || src.height;\n\t\tsuper(x, y, w, h);\n\t\tthis.type = 'image';\n\t\tthis.image = src;\n\t\tthis.imgRatio = src.width / src.height;\n\t}\n\n\tscaleImage({ w = null, h = null }) {\n\t\tif (w !== null && h === null) {\n\t\t\tthis.w = w;\n\t\t\tthis.h = w / this.imgRatio;\n\t\t} else if (h !== null && w === null) {\n\t\t\tthis.h = h;\n\t\t\tthis.w = h / this.imgRatio;\n\t\t} else if ( h !== null && w !== null) {\n\t\t\tthis.w = w;\n\t\t\tthis.h = h;\n\t\t}\n\t}\n}\n","import * as gui from './index.mjs';\nimport GuiElement from './element.mjs';\n\nexport default class GuiButton extends GuiElement {\n\tconstructor(text, onclick, x, y, w = 100, h = 30) {\n\t\tsuper(x, y, w, h);\n\t\tthis.type = 'button';\n\t\tthis.text = text;\n\t\tthis.onclick = onclick;\n\t}\n\n\tclick() {\n\t\tif (this.options.draw)\n\t\t\tthis.onclick();\n\t}\n}\n","/*\n *\tConstants that do not change during gameplay.\n *\tThis can kind of be treated like a configuration file, I guess.\n *\n *\tAll length units are relative to the size of a small ship module, which\n *\tis always 1x1.\n */\n\n// For fixing floating point rounding errors.\nexport const EPSILON = 1e-8;\n// Unit length of sector. Only for internal representation.\nexport const SECTOR_SIZE = 512;\n// G, G-boy, The big G, Mr. G, g's big brother, G-dog\nexport const GRAVITATIONAL_CONSTANT = 0.01;\n// Perspective constraints. Higher zoom value = closer.\nexport const MIN_ZOOM = 1;\nexport const MAX_ZOOM = 100;\nexport const DEFAULT_ZOOM = 10;\nexport const ZOOM_SPEED = 0.01;\n// Ship landing. Angle in radians.\nexport const TIP_ANGLE = 30.3;\nexport const TIP_SPEED = 0.015;\n// Ship flight mechanics. Speed measured in units per tick.\nexport const FUEL_BURN_RATE = 0.01;\n// Distance at which an orbited planet will not be considered a parent body.\nexport const MAX_PARENT_CELESTIAL_DISTANCE = 120;\n","import {images as assets} from '../assets.mjs';\n\nexport default class Module {\n\tconstructor(x, y, ship, {\n\t\tname = 'Unnamed Module',\n\t\ttype = 'block',\n\t\tid = 'unknown',\n\t\tmass = 1,\n\t\t// Fuel\n\t\tfilled = false,\n\t\tfuelCapacity = 0,\n\t\t...properties\n\t}) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tthis.mass = mass;\n\t\tthis.ship = ship;\n\t\tthis.id = id;\n\t\tthis.images = assets.modules[this.type][this.id];\n\t\t// Fuel\n\t\tif (this.type == 'fuel') {\n\t\t\tthis.fuel = filled ? fuelCapacity : 0;\n\t\t} else if (this.type == 'thruster') {\n\t\t\tthis.power = 0;\n\t\t}\n\t}\n\n\treset() {\n\t\tif (this.type == 'thruster') {\n\t\t\tthis.power = 0;\n\t\t}\n\t}\n\n\tget com() {\n\t\treturn this.ship.getWorldPoint(...this.localCom);\n\t}\n\n\tget currentImage() {\n\t\tif (this.type == 'thruster') {\n\t\t\treturn this.power > 0 ? this.images.on : this.images.off;\n\t\t} else {\n\t\t\treturn this.images;\n\t\t}\n\t}\n\n\tget localCom() {\n\t\treturn [this.x + 0.5, this.y + 0.5];\n\t}\n}\n","import {GRAVITATIONAL_CONSTANT as G} from '../consts.mjs';\n\nexport default class Body {\n\tconstructor(x, y, mass) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.r = 0;\n\t\tthis.xvel = 0;\n\t\tthis.yvel = 0;\n\t\tthis.rvel = 0;\n\t\tthis.rfriction = 0.9;\n\t\tthis.mass = mass;\n\t}\n\n\tget com() {\n\t\treturn [this.x, this.y];\n\t}\n\n\tget pos() {\n\t\treturn [this.x, this.y];\n\t}\n\n\tget speed() {\n\t\treturn Math.sqrt(this.xvel ** 2 + this.yvel ** 2);\n\t}\n\n\tgetWorldPoint(lx, ly) {\n\t\tlet [cx, cy] = this.localCom;\n\t\tlet [nx, ny] = this.rotateVector(lx - cx, ly - cy, this.r);\n\t\treturn [nx + this.x + cx, ny + this.y + cy];\n\t}\n\n\tgetLocalPoint(wx, wy) {\n\t\tlet [lx, ly] = [wx - this.x, wy - this.y];\n\t\tlet [cx, cy] = this.localCom;\n\t\tlet [nx, ny] = this.rotateVector(lx, ly, -this.r);\n\t\treturn [nx - cx, ny - cy];\n\t}\n\n\trotateVector(x, y, r = this.r) {\n\t\treturn [(x * Math.cos(r) - y * Math.sin(r)),\n\t\t\t(y * Math.cos(r) - x * Math.sin(r))];\n\t}\n\n\trelativeVector(x, y) {\n\t\treturn this.rotateVector(x, y, this.r);\n\t}\n\n\ttickMotion() {\n\t\tthis.x += this.xvel;\n\t\tthis.y += this.yvel;\n\t\tthis.r += this.rvel;\n\t\tthis.rvel *= this.rfriction;\n\t}\n\n\ttickGravity(bodies) {\n\t\tbodies.forEach(b => {\n\t\t\tlet force = b.mass / this.mass / (this.distanceTo(b) ** 2) * G;\n\t\t\tlet [[ax, ay], [bx, by]] = [this.com, b.com];\n\t\t\tlet angle = Math.atan2(by - ay, bx - ax);\n\t\t\tthis.xvel += Math.cos(angle) * force;\n\t\t\tthis.yvel += Math.sin(angle) * force;\n\t\t});\n\t}\n\n\tdistanceTo(body) {\n\t\tlet [[ax, ay], [bx, by]] = [this.com, body.com];\n\t\treturn Math.max(Math.sqrt(((bx - ax) ** 2) +\n\t\t\t((by - ay) ** 2)), 1);\n\t}\n\n\tangleTo(ax, ay, bx, by) {\n\t\treturn Math.atan2(by - ay, bx - ax);\n\t}\n\n\tapproach(body, distance) {\n\t\tlet [[ax, ay], [bx, by]] = [this.com, body.com];\n\t\tlet angle = Math.atan2(by - ay, bx - ax);\n\t\tthis.x += Math.cos(angle) * distance;\n\t\tthis.y += Math.sin(angle) * distance;\n\t}\n\n\thalt() {\n\t\tthis.xvel = 0;\n\t\tthis.yvel = 0;\n\t}\n\n\tapplyDirectionalForce(x, y, r) {\n\t\tlet [vx, vy] = this.rotateVector(x, y);\n\t\tthis.xvel += vx;\n\t\tthis.yvel += vy;\n\t\tthis.rvel += r / this.mass;\n\t}\n}\n","import Body from './body.mjs';\nimport {celestials, particles} from './index.mjs';\n\nexport function createThrustExhaust(thruster) {\n\tlet ship = thruster.ship;\n\tlet [fx, fy] = ship.relativeVector(0, 0.2);\n\tlet [dx, dy] = ship.relativeVector((Math.random() - 0.5) * 0.5, 0.5);\n\tlet [cx, cy] = thruster.com;\n\tparticles.add(new Particle(cx + dx, cy + dy, {\n\t\txvel: ship.xvel + fx,\n\t\tyvel: ship.yvel + fy,\n\t\tcolor: '#f4c542',\n\t\tlifetime: 5,\n\t\tsize: 0.07\n\t}));\n}\n\nclass Particle extends Body {\n\tconstructor(x, y, {\n\t\txvel = 0,\n\t\tyvel = 0,\n\t\tspray = 0.1,\n\t\tfizzle = 0,\n\t\tmaxFizzle = fizzle * 2,\n\t\tcolor = '#fff',\n\t\tgravity = false,\n\t\tlifetime = 50,\n\t\tsize = 0.1,\n\t\tfriction = 0.99\n\t}) {\n\t\tsuper(x, y, 0.1);\n\n\t\tthis.size = size;\n\t\tthis.xvel = xvel + (Math.random() - 0.5) * spray;\n\t\tthis.yvel = yvel + (Math.random() - 0.5) * spray;\n\t\tthis.friction = friction;\n\t\tthis.fizzle = fizzle;\n\t\tthis.maxFizzle = maxFizzle;\n\t\tthis.color = color;\n\t\tthis.gravity = gravity;\n\t\tthis.life = lifetime;\n\t}\n\n\tget com() {\n\t\treturn [this.x - this.size / 2, this.y - this.size / 2];\n\t}\n\n\ttick() {\n\t\tif (!this.life--) {\n\t\t\tparticles.delete(this);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.tickMotion();\n\t\tif (this.gravity) this.tickGravity(celestials);\n\n\t\tthis.xvel *= this.friction;\n\t\tthis.yvel *= this.friction;\n\t\tthis.x += (Math.random() - 0.5) * this.fizzle;\n\t\tthis.y += (Math.random() - 0.5) * this.fizzle;\n\t\tif (this.fizzle < this.mazFizzle) this.fizzle *= 1.05;\n\t}\n}\n","import Module from './module.mjs';\nimport Body from './body.mjs';\nimport * as world from './index.mjs';\nimport * as consts from '../consts.mjs';\nimport * as particle from './particle.mjs';\nimport * as events from '../game/events.mjs';\nimport {state} from '../game/index.mjs';\n\nexport default class Ship extends Body {\n\tconstructor(x, y) {\n\t\tsuper(x, y, 0);\n\n\t\tthis.localCom = [0, 0];\n\t\tthis.modules = new Set();\n\t\tthis.maxRadius = 0;\n\t\tthis.landed = false;\n\t}\n\n\tget com() {\n\t\tlet [lx, ly] = this.localCom;\n\t\treturn [this.x + lx, this.y + ly];\n\t}\n\n\tget parentCelestial() {\n\t\tlet closest = null;\n\t\tlet closestDistance = 0;\n\n\t\tworld.celestials.forEach(c => {\n\t\t\tlet dis = this.distanceTo(c);\n\t\t\tif (closest === null || dis < closestDistance) {\n\t\t\t\tclosest = c;\n\t\t\t\tclosestDistance = dis;\n\t\t\t}\n\t\t});\n\n\t\tif (closestDistance > consts.MAX_PARENT_CELESTIAL_DISTANCE)\n\t\t\treturn null;\n\t\t\t\n\t\treturn closest;\n\t}\n\n\ttick() {\n\t\tthis.tickMotion();\n\t\tif (!this.landed) this.tickGravity(world.celestials);\n\t\tthis.resolveCollisions();\n\n\t\tthis.modules.forEach(m => {\n\t\t\tif (m.type == 'thruster' && m.power !== 0) {\n\t\t\t\tfor (let i = 0; i < 2; i++) particle.createThrustExhaust(m);\n\t\t\t}\n\t\t});\n\n\t\tthis.modules.forEach(m => m.reset());\n\n\t\tif (events.shipLanded != this.landed)\n\t\t\tthis.landed ? events.landShip() : events.launchShip();\n\t}\n\n\taddModule(x, y, properties, options) {\n\t\tlet module = new Module(x, y, this, {...properties, ...options});\n\t\tthis.modules.add(module);\n\t\tthis.refreshShape();\n\t}\n\n\tdeleteModule(module) {\n\t\tthis.modules.delete(module);\n\t\tthis.refreshShape();\n\t}\n\n\trefreshShape() {\n\t\tlet points = [];\n\t\tthis.modules.forEach(m => points.push([...m.localCom, m.mass]));\n\t\tthis.mass = points.reduce((a, [,,b]) => a + b, 0);\n\t\tthis.localCom = points.reduce(([ax, ay], [bx, by, bm]) =>\n\t\t\t[ax + bx * bm, ay + by * bm], [0, 0])\n\t\t\t.map(x => x / this.mass);\n\t\tlet [lx, ly] = this.localCom;\n\t\tthis.maxRadius = points.reduce((a, [bx, by]) =>\n\t\t\tMath.max(Math.sqrt((bx - lx) ** 2 + (by - ly) ** 2), a), 0) + 1;\n\t}\n\n\tresolveCollisions() {\n\t\tthis.landed = false;\n\n\t\tworld.celestials.forEach(c => {\n\t\t\tlet dis = this.distanceTo(c);\n\n\t\t\tif (dis < c.radius + this.maxRadius) {\n\t\t\t\tthis.modules.forEach(m => {\n\t\t\t\t\tthis.checkModuleCollision(m, c);\n\t\t\t\t});\n\t\t\t}\n\t\t})\n\t}\n\n\tresolveCelestialCollision(pos, cel) {\n\t\t//debugger;\n\t\tlet theta = this.angleTo(...this.com, ...cel.com);\n\t\tlet angleToCom = this.angleTo(...this.com, ...pos);\n\t\tlet angle = angleToCom - theta;\n\t\tlet [force] = this.rotateVector(0, 1, angle);\n\t\tif (Math.abs(angle) < consts.TIP_ANGLE) {\n\t\t\tforce *= -1;\n\t\t}\n\t\tif (Math.abs(angle) < 0.003\n\t\t\t&& Math.abs(this.rvel) < 0.001) {\n\t\t\tthis.landed = true;\n\t\t\tthis.rvel = 0;\n\t\t\tthis.r = theta - Math.PI / 2;\n\t\t}\n\t\tthis.rvel -= force * consts.TIP_SPEED;\n\t}\n\n\tcheckModuleCollision(module, body) {\n\t\tlet p = this.getWorldPoint(...module.localCom);\n\t\tlet dis = body.distanceTo({ com: p });\n\t\tif (dis < body.radius + 0.5 + consts.EPSILON) {\n\t\t\tthis.approach(body, dis - (body.radius + 0.5));\n\t\t\tthis.halt();\n\t\t\tthis.resolveCelestialCollision(p, body);\n\t\t}\n\t}\n\n\tapplyThrust({ forward = 0, left = 0, right = 0, back = 0,\n\t\tturnLeft = 0, turnRight = 0}) {\n\t\tlet turnForce = (turnRight - turnLeft) / 20;\n\t\tthis.applyDirectionalForce(0, -forward / 30, turnForce);\n\n\t\tthis.modules.forEach(m => {\n\t\t\tif (m.type !== 'thruster') return;\n\t\t\tm.power = forward;\n\t\t});\n\n\t}\n}\n","import {images as assets} from '../assets.mjs';\nimport Body from './body.mjs';\n\nexport default class Celestial extends Body {\n\tconstructor(x, y, radius, {\n\t\tdensity = 1,\n\t\ttype = 'rock'\n\t}) {\n\t\tlet mass = (radius ** 2) * density\n\t\tsuper(x, y, mass);\n\t\tthis.radius = radius;\n\n\t\tthis.type = type;\n\t\tlet imageArr = Object.values(assets.celestials[this.type]);\n\t\tthis.image = imageArr[Math.random() * imageArr.length | 0];\n\t}\n\n\tget com() {\n\t\treturn [this.x + this.radius, this.y + this.radius];\n\t}\n\n\tget escapeVelocity() {\n\t\t\n\t}\n\n\ttick() {\n\n\t}\n\n\tget diameter() {\n\t\treturn this.radius * 2;\n\t}\n}\n","export const modules = {\n\tcapsule: {\n\t\tsmall: {\n\t\t\tname: 'Small Capsule',\n\t\t\ttooltip: 'A small, simple capsule. Provides just enough ' +\n\t\t\t\t'rotational power for a small rocket.',\n\t\t\ttype: 'capsule',\n\t\t\tid: 'small',\n\t\t\tmass: 2,\n\t\t\trotation: 0.1\n\t\t}\n\t},\n\tfuel: {\n\t\tsmall: {\n\t\t\tname: 'Small Fuel Tank',\n\t\t\ttooltip: 'A small flimsy tank with enough fuel for a short trip.',\n\t\t\ttype: 'fuel',\n\t\t\tid: 'small',\n\t\t\tmass: 1,\n\t\t\tcapacity: 3\n\t\t}\n\t},\n\tthruster: {\n\t\tlight: {\n\t\t\tname: 'Light Main Thruster',\n\t\t\ttooltip: 'Powerful enough to lift a small ship, but not much ' +\n\t\t\t\t'more. Not very efficient.',\n\t\t\ttype: 'thruster',\n\t\t\tid: 'light',\n\t\t\tmass: 2,\n\t\t\tthrust: 10,\n\t\t\tisp: 200\n\t\t}\n\t}\n}\n","import Ship from './ship.mjs';\nimport Module from './module.mjs';\nimport Celestial from './celestial.mjs';\nimport {modules} from '../data.mjs';\nimport * as world from './index.mjs';\n\nexport function player() {\n\tlet ship = new Ship(0, -45);\n\tship.addModule(0, 0, modules.capsule.small);\n\tship.addModule(0, 1, modules.fuel.small, { filled: true });\n\tship.addModule(0, 2, modules.thruster.light);\n\tworld.ships.add(ship);\n\tworld.setPlayerShip(ship);\n\treturn ship;\n}\n\nexport function startPlanet() {\n\treturn celestial(0, 0, 40, {\n\t\tdensity: 10,\n\t\ttype: 'green'\n\t});\n}\n\nexport function celestial(x, y, radius, params) {\n\tlet celestial = new Celestial(x - radius, y - radius, radius, params);\n\tworld.celestials.add(celestial);\n\treturn celestial;\n}\n","import * as sector from './sector.mjs';\nimport * as spawn from './spawn.mjs';\n\nexport {getSectorFromWorld, getContainedSectors} from './sector.mjs';\n\nexport const entities = new Set();\nexport const celestials = new Set();\nexport const ships = new Set();\nexport const particles = new Set();\n\nexport let playerShip = null;\n\nexport function setPlayerShip(ship) {\n\tplayerShip = ship;\n}\n\nexport function init() {\n\tentities.clear();\n\tcelestials.clear();\n\tships.clear();\n\tparticles.clear();\n\tspawn.player();\n\tspawn.startPlanet();\n}\n\nexport function tick() {\n\tparticles.forEach(p => p.tick());\n\tcelestials.forEach(c => c.tick());\n\tentities.forEach(e => e.tick());\n\tships.forEach(s => s.tick());\n}\n","import * as world from '../world/index.mjs';\nimport * as inventory from './inventory.mjs';\n\nexport let ship;\n\nexport function init() {\n\tship = world.playerShip;\n}\n","import * as game from './index.mjs';\nimport * as graphics from '../graphics/index.mjs';\n\nexport function init() {\n\tgraphics.setZoom(20);\n}\n\nexport function end() {\n\n}\n","import * as game from './index.mjs';\nimport * as graphics from '../graphics/index.mjs';\nimport * as world from '../world/index.mjs';\nimport * as player from './player.mjs';\nimport * as edit from './edit.mjs';\n\nexport let shipLanded = false;\n\nexport function startGame() {\n\tgame.changeView('game');\n\tgraphics.perspective.focusPlayer();\n}\n\nexport function landShip() {\n\tshipLanded = true;\n\tgame.state.landed = true;\n}\n\nexport function launchShip() {\n\tshipLanded = false;\n\tgame.state.landed = false;\n}\n\nexport function editShip() {\n\tconsole.log('a');\n\tgraphics.changePerspective('parent', -5, 0);\n\tgame.state.editing = true;\n\tedit.init();\n}\n\nexport function endEditing() {\n\tgraphics.changePerspective('universe');\n\tgame.state.editing = false;\n\tedit.end();\n}\n","import * as gui from './index.mjs';\nimport {images as assets} from '../assets.mjs';\nimport {canvas} from '../graphics/index.mjs';\nimport GuiFrame from './frame.mjs';\nimport GuiImage from './image.mjs';\nimport GuiButton from './button.mjs';\nimport * as events from '../game/events.mjs';\nimport {state} from '../game/index.mjs';\n\nexport function root() {\n\treturn new GuiFrame(0, 0, canvas.width, canvas.height, {\n\t\tdraw: false\n\t});\n}\n\nexport function title() {\n\tlet shadow = root();\n\tlet logo = new GuiImage(assets.title.logo);\n\tshadow.append(logo);\n\tlogo.scaleImage({ w: shadow.w * 0.7 });\n\tlogo.posRelative({ x: 0.5, xc: 0.5, y: 0.2 });\n\n\t// TODO: Implement call to change view to game.\n\tlet startFunction = events.startGame;\n\tlet start = new GuiButton('Start game', events.startGame, 0, 0, 200);\n\tshadow.append(start);\n\tstart.posRelative({ x: 0.5, xc: 0.5, y: 0.7 });\n\n\tlet secondFunction = () => {};\n\tlet second = new GuiButton('Don\\'t start game', secondFunction, 0, 0, 200);\n\tshadow.append(second);\n\tsecond.posRelative({ x: 0.5, xc: 0.5, y: 0.7 });\n\tsecond.y += 60;\n\n\treturn shadow;\n}\n\nexport function game() {\n\tlet shadow = root();\n\n\tlet edit = new GuiButton('Edit rocket', events.editShip, 0, 0, 200);\n\tshadow.append(edit);\n\tedit.posRelative({ x: 0.5, xc: 0.5, y: 1 });\n\tedit.y -= 45;\n\tedit.tick = () => {\n\t\tedit.options.draw = state.landed && !state.editing;\n\t}\n\n\treturn shadow;\n}\n","import {context} from '../graphics/index.mjs';\nimport * as modules from './modules.mjs';\n\nexport const elements = new Set();\nexport let root;\n\nexport function init() {\n\telements.clear();\n\troot = modules.root();\n\tchangeView('title');\n}\n\nexport function tick() {\n\troot.tickElement();\n}\n\nexport function changeView(view) {\n\troot.clear();\n\n\tif (view == 'title') {\n\t\troot.append(modules.title());\n\t}\n\n\tif (view == 'game') {\n\t\troot.append(modules.game());\n\t}\n}\n\nexport function measureText(msg, font) {\n\tcontext.font = font;\n\tlet measurement = context.measureText(msg);\n\treturn [measurement.width, measurement.height];\n}\n","import {canvas, context} from './index.mjs';\n\nexport function text(string, x, y,\n\t{font = '52pt Arial', align = 'left', valign = 'top', color = null}) {\n\tcontext.textAlign = align;\n\tcontext.textBaseline = valign;\n\tcontext.fillStyle = color === null ? context.fillStyle : color;\n\tcontext.font = font;\n\n\tcontext.fillText(string, x, y);\n}\n","import {canvas, context} from './index.mjs';\nimport * as gui from '../gui/index.mjs';\nimport * as draw from './draw.mjs';\n\nexport function render() {\n\trenderElement(gui.root);\n}\n\nfunction renderElement(element) {\n\t//console.log(element.options);\n\tif (element.options.draw) {\n\t\tif (element.type == 'frame') renderFrame(element);\n\t\tif (element.type == 'image') renderImage(element);\n\t\tif (element.type == 'button') renderButton(element);\n\t}\n\telement.children.forEach(renderElement);\n}\n\nfunction renderFrame(element) {\n\tcontext.fillStyle = '#eb9';\n\tcontext.fillRect(...element.shape);\n}\n\nfunction renderImage(element) {\n\tcontext.drawImage(element.image, ...element.shape);\n}\n\nfunction renderButton(element) {\n\tif (element.mouseHeld) {\n\t\tcontext.fillStyle = '#706244';\n\t} else {\n\t\tcontext.fillStyle = element.mouseOver ? '#ad9869' : '#917f58';\n\t}\n\t\n\tcontext.fillRect(...element.shape);\n\tcontext.strokeStyle = '#541';\n\tcontext.strokeWidth = 4;\n\tcontext.strokeRect(...element.shape);\n\tcontext.textAlign = 'center';\n\tcontext.textBaseline = 'middle';\n\tcontext.fillStyle = '#fff';\n\tcontext.font = '12pt Consolas';\n\tcontext.fillText(element.text, ...element.center);\n}\n","import {canvas, context} from './index.mjs';\nimport {images as assets} from '../assets.mjs';\nimport * as world from '../world/index.mjs';\n\nexport function render() {\n\tworld.particles.forEach(renderParticle);\n\tworld.celestials.forEach(renderCelestial);\n\tworld.ships.forEach(renderShip);\n}\n\nfunction renderParticle(particle) {\n\tcontext.fillStyle = particle.color;\n\tcontext.fillRect(...particle.com, particle.size, particle.size);\n}\n\nfunction renderShip(ship) {\n\tcontext.save();\n\tcontext.translate(...ship.com);\n\tcontext.rotate(ship.r);\n\tlet [cx, cy] = ship.localCom;\n\tcontext.translate(-cx, -cy);\n\tship.modules.forEach(m => {\n\t\tcontext.drawImage(m.currentImage, m.x, m.y, 1, 1);\n\t});\n\tcontext.restore();\n}\n\nconst celestialImages = {\n\tgreen: Object.values(assets.celestials.green)\n}\n\nfunction renderCelestial(cel) {\n\tcontext.drawImage(cel.image, cel.x, cel.y,\n\t\tcel.diameter, cel.diameter);\n}\n","import {canvas, context, perspective} from './index.mjs';\nimport {images as assets} from '../assets.mjs';\n\nlet patterns = null;\n\nfunction init() {\n\tpatterns = {\n\t\tback: context.createPattern(assets.background.back, 'repeat'),\n\t\tmiddle: context.createPattern(assets.background.middle, 'repeat'),\n\t\tfront: context.createPattern(assets.background.front, 'repeat')\n\t};\n}\n\nexport function render(angle) {\n\tif (patterns === null) init();\n\n\trenderLayer(patterns.back, 0.3, 1, angle);\n\trenderLayer(patterns.middle, 0.5, 0.3, angle);\n\t//renderLayer(patterns.front, 0.7, 0.3, angle);\n}\n\nfunction renderLayer(pattern, speed = 1, scale = 1, angle = 0) {\n\tcontext.save();\n\tlet outset = (Math.abs(Math.cos(angle)) + Math.abs(Math.sin(angle)));\n\toutset = ((outset - 1) * canvas.width) / scale;\n\tlet [px, py] = [perspective.x * speed, perspective.y * speed];\n\tcontext.translate(-px, -py);\n\tcontext.scale(scale, scale);\n\tcontext.fillStyle = pattern;\n\tcontext.fillRect(px / scale - outset / 2, py / scale - outset / 2,\n\t\tcanvas.width / scale + outset, canvas.height / scale + outset);\n\tcontext.restore();\n}\n","import * as gui from './gui.mjs';\nimport * as draw from './draw.mjs';\nimport * as input from '../input.mjs';\nimport {render as renderWorld} from './world.mjs';\nimport {render as renderBackground} from './background.mjs';\nimport * as world from '../world/index.mjs';\nimport * as consts from '../consts.mjs';\n\nexport let canvas, context, tempCanvas, tempContext;\nexport let perspective;\n\nexport function init() {\n\tcanvas = document.querySelector('#main');\n\tcontext = canvas.getContext('2d');\n\ttempCanvas = document.querySelector('#temp');\n\ttempContext = tempCanvas.getContext('2d');\n\n\tcanvas.width = 600;\n\tcanvas.height = 600;\n\n\tperspective = new Perspective();\n\n\tdraw.text('Loading...', canvas.width / 2, canvas.height / 2,\n\t\t{ align: 'center', valign: 'middle' });\n}\n\nexport function render() {\n\tcontext.clearRect(0, 0, canvas.width, canvas.height);\n\tcontext.fillStyle = '#000';\n\tcontext.fillRect(0, 0, canvas.width, canvas.height);\n\n\tcontext.save();\n\tperspective.tick();\n\tperspective.transformRotate();\n\trenderBackground(perspective.rotation);\n\tperspective.transformCanvas();\n\trenderWorld();\n\tcontext.restore();\n\n\tgui.render();\n}\n\nexport function getVisibleSectors() {\n\treturn world.getContainedSectors(...perspective.bounds);\n}\n\nexport function changePerspective(rotationMode, shiftX = 0, shiftY = 0) {\n\tperspective.changeRotationMode(rotationMode);\n\tperspective.changeShift(shiftX, shiftY);\n\tperspective.transition = 1;\n}\n\nexport function changeZoom(delta) {\n\tperspective.zoomDelta(delta);\n}\n\nexport function setZoom(target) {\n\tperspective.changeZoom(target);\n}\n\nclass Perspective {\n\tconstructor() {\n\t\tthis.x = 0;\n\t\tthis.y = 0;\n\t\tthis.shiftX = 0;\n\t\tthis.shiftY = 0;\n\t\tthis.zoom = 0;\n\t\tthis.bounds = [0, 0, canvas.width, canvas.height];\n\t\tthis.rotationMode = 'universe';\n\t\tthis.targetZoom = consts.DEFAULT_ZOOM;\n\t\tthis.oldTarget = 0;\n\t\tthis.oldShift = [0, 0];\n\t\tthis.oldZoom = 0;\n\t\tthis.transition = 0;\n\t\tthis.zoomTransition = 0;\n\t\tthis.reset();\n\t}\n\n\tchangeRotationMode(mode) {\n\t\tthis.oldTarget = this.targetRotation;\n\t\tthis.rotationMode = mode;\n\t}\n\n\tchangeShift(x, y) {\n\t\tthis.oldShift = this.currentShift;\n\t\t[this.shiftX, this.shiftY] = [x, y];\n\t}\n\n\tchangeZoom(zoom) {\n\t\tthis.oldZoom = this.currentZoom;\n\t\tthis.targetZoom = zoom;\n\t\tthis.zoomTransition = 1;\n\t}\n\n\tget currentShift() {\n\t\tlet [ox, oy] = this.oldShift;\n\t\treturn [this.interpolate(this.shiftX, ox),\n\t\t\tthis.interpolate(this.shiftY, oy)];\n\t}\n\n\tget currentRotation() {\n\t\treturn this.interpolate(this.targetRotation, this.oldTarget);\n\t}\n\n\tget currentZoom() {\n\t\tlet t = this.zoomTransition;\n\t\treturn (this.oldZoom * t + this.targetZoom * (1 - t));\n\t}\n\n\tinterpolate(cur, old, x = this.transition) {\n\t\treturn (old * x + cur * (1 - x));\n\t}\n\n\ttick() {\n\t\tif (this.focus !== null)\n\t\t\t[this.x, this.y] = this.focus.com;\n\n\t\tif (this.focus === null || this.rotationMode === 'universe') {\n\t\t\tthis.targetRotation = 0;\n\t\t} else if (this.rotationMode === 'parent') {\n\t\t\tlet parent = this.focus.parentCelestial;\n\t\t\tif (parent === null) {\n\t\t\t\tthis.targetRotation = 0;\n\t\t\t} else {\n\t\t\t\tlet a = this.focus.angleTo(...this.focus.com, ...parent.com);\n\t\t\t\tthis.targetRotation = a - Math.PI / 2;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.targetRotation = this.focus.r;\n\t\t}\n\n\t\tlet dif = Math.abs(this.targetRotation - this.rotation);\n\t\tthis.rotationMet = dif < (this.rotationMet ? 0.3 : 0.05);\n\n\t\tthis.rotation = this.currentRotation;\n\t\tthis.zoom = this.currentZoom;\n\n\t\tthis.transition *= 0.9;\n\t\tthis.zoomTransition *= 0.9;\n\n\t\tthis.normalize();\n\t}\n\n\treset() {\n\t\tthis.rotation = 0;\n\t\tthis.targetRotation = 0;\n\t\tthis.zoom = consts.DEFAULT_ZOOM;\n\t\tthis.targetZoom = this.zoom;\n\t\tthis.focus = null;\n\t\tthis.rotationFocus = null;\n\t}\n\n\tfocusPlayer() {\n\t\tthis.focus = world.playerShip;\n\t\tthis.rotationFocus = world.playerShip;\n\t}\n\n\tzoomDelta(delta) {\n\t\tlet factor = 1 + (consts.ZOOM_SPEED * Math.abs(delta));\n\t\tthis.targetZoom *= delta > 0 ? factor : 1 / factor;\n\t\tthis.normalize();\n\t}\n\n\tnormalize() {\n\t\tthis.targetZoom = Math.max(consts.MIN_ZOOM,\n\t\t\tMath.min(consts.MAX_ZOOM, this.targetZoom));\n\t\tthis.targetRotation %= (Math.PI * 2);\n\t}\n\n\ttransformRotate() {\n\t\tlet [,,bw, bh] = this.bounds;\n\t\tcontext.translate(bw / 2, bh / 2);\n\t\tcontext.rotate(-this.rotation);\n\t\tcontext.translate(-bw / 2, -bh / 2);\n\t}\n\n\trotateVector(x, y, r = this.rotation) {\n\t\treturn [(x * Math.cos(r) - y * Math.sin(r)),\n\t\t\t(y * Math.cos(r) - x * Math.sin(r))];\n\t}\n\n\ttransformCanvas() {\n\t\tlet [,,bw, bh] = this.bounds;\n\t\tlet [sx, sy] = this.rotateVector(...this.currentShift, -this.rotation);\n\t\tlet tx = -(this.x + sx) * this.zoom;\n\t\tlet ty = -(this.y + sy) * this.zoom;\n\t\tcontext.translate(tx + bw / 2, ty + bh / 2);\n\t\tcontext.scale(this.zoom, this.zoom);\n\t}\n}\n","import * as input from '../input.mjs';\nimport * as events from './events.mjs';\nimport * as player from './player.mjs';\nimport * as graphics from '../graphics/index.mjs';\nimport {state} from './index.mjs';\n\nexport const mapping = {\n\tthrust: 'KeyW',\n\tleft: 'KeyA',\n\tright: 'KeyD',\n\texitEdit: 'Escape'\n};\n\nlet held, pressed;\n\nexport function tick() {\n\theld = input.keyCode.held;\n\tpressed = input.keyCode.pressed;\n\n\tif (state.editing) {\n\t\ttickEditing();\n\t} else if (state.playing) {\n\t\ttickPlaying();\n\t}\n\n\tif (!state.editing) {\n\t\tif (input.mouse.scroll !== 0) {\n\t\t\tgraphics.changeZoom(-input.mouse.scroll);\n\t\t}\n\t}\n}\n\nfunction tickPlaying() {\n\tif (held[mapping.thrust]) {\n\t\tplayer.ship.applyThrust({ forward: 1 });\n\t}\n\n\tif (held[mapping.left]) {\n\t\tplayer.ship.applyThrust({ turnLeft: 1 });\n\t}\n\n\tif (held[mapping.right]) {\n\t\tplayer.ship.applyThrust({ turnRight: 1 });\n\t}\n}\n\nfunction tickEditing() {\n\tif (held[mapping.exitEdit]) {\n\t\tevents.endEditing();\n\t}\n}\n","import * as graphics from '../graphics/index.mjs';\nimport * as gui from '../gui/index.mjs';\nimport * as assets from '../assets.mjs';\nimport * as input from '../input.mjs';\nimport * as world from '../world/index.mjs';\nimport * as events from './events.mjs';\nimport * as control from './control.mjs';\nimport * as player from './player.mjs';\nimport * as edit from './edit.mjs';\n\nexport let state;\n\nexport async function init() {\n\tstate = {\n\t\tview: 'menu',\n\t\tplaying: false,\n\t\tediting: false,\n\t\tpaused: false\n\t};\n\n\tgraphics.init();\n\tawait assets.init();\n\tgui.init();\n\tinput.init();\n\n\t//events.startGame();\n\n\t//tick(); return;\n\n\t// Recursive `requestAnimationFrame` can cause problems with Parcel.\n\twhile(true) {\n\t\tawait tick();\n\t\tawait new Promise(res => requestAnimationFrame(res));\n\t}\n}\n\nexport function changeView(view) {\n\tstate.view = view;\n\tgui.changeView(view);\n\n\tif (view == 'game') {\n\t\tstate.playing = true;\n\t\tstate.editing = false;\n\t\tstate.paused = false;\n\t\tworld.init();\n\t\tplayer.init();\n\t}\n}\n\nasync function tick() {\n\tif (state.view == 'game') {\n\t\tworld.tick();\n\t\tcontrol.tick();\n\t}\n\n\tgui.tick();\n\tgraphics.render();\n\tinput.tick();\n}\n","import { init } from './game/index.mjs';\n\nwindow.addEventListener('load', init);\n"],"names":["init","input.mouse","assets","G","world.celestials","consts.MAX_PARENT_CELESTIAL_DISTANCE","particle.createThrustExhaust","events.shipLanded","events.landShip","events.launchShip","consts.TIP_ANGLE","consts.TIP_SPEED","consts.EPSILON","world.ships","world.setPlayerShip","spawn.player","spawn.startPlanet","tick","world.playerShip","graphics.setZoom","game.changeView","graphics.perspective","game.state","graphics.changePerspective","edit.init","events.startGame","events.editShip","root","modules.root","modules.title","modules.game","gui.root","render","world.particles","draw.text","renderBackground","renderWorld","gui.render","consts.DEFAULT_ZOOM","consts.ZOOM_SPEED","consts.MIN_ZOOM","consts.MAX_ZOOM","mapping","input.keyCode","graphics.changeZoom","player.ship","events.endEditing","graphics.init","assets.init","gui.init","input.init","changeView","gui.changeView","world.init","player.init","world.tick","control.tick","gui.tick","graphics.render","input.tick"],"mappings":"AAAO,MAAM,MAAM,GAAG;CACrB,KAAK,EAAE;EACN,IAAI,EAAE,UAAU;EAChB,OAAO,EAAE,WAAW;EACpB;CACD,UAAU,EAAE;EACX,IAAI,EAAE,gBAAgB;EACtB,MAAM,EAAE,gBAAgB;EACxB,KAAK,EAAE,iBAAiB;EACxB;CACD,OAAO,EAAE;EACR,OAAO,EAAE;GACR,KAAK,EAAE,2BAA2B;GAClC;EACD,IAAI,EAAE;GACL,KAAK,EAAE,6BAA6B;GACpC;EACD,QAAQ,EAAE;GACT,KAAK,EAAE;IACN,GAAG,EAAE,4BAA4B;IACjC,EAAE,EAAE,+BAA+B;IACnC;GACD;EACD;CACD,UAAU,EAAE;EACX,KAAK,EAAE;GACN,GAAG,EAAE,wBAAwB;GAC7B;EACD;CACD,CAAC;;AAEF,AAAO,MAAM,KAAK,GAAG,EAAE,CAAC;;AAExB,AAAO,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CAClBC,UAAc,CAAC,IAAI,CAAC,CAAC;;CAErB,IAAI,IAAI,IAAI,MAAM,EAAE;EACnB,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;EACrB,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;EACtB,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;EACrBC,MAAU,EAAE,CAAC;EACbC,MAAW,EAAE,CAAC;EACd;CACD;;AAED,eAAerC,MAAI,GAAG;CACrB,IAAI,KAAK,CAAC,IAAI,IAAI,MAAM,EAAE;EACzBsC,MAAU,EAAE,CAAC;EACbC,MAAY,EAAE,CAAC;EACf;;CAEDC,MAAQ,EAAE,CAAC;CACXC,QAAe,EAAE,CAAC;CAClBC,IAAU,EAAE,CAAC;CACb;;ACxDD,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE3D,MAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/js/consts.mjs b/js/consts.mjs index 5f9fa41..00b9124 100644 --- a/js/consts.mjs +++ b/js/consts.mjs @@ -2,13 +2,14 @@ * Constants that do not change during gameplay. * This can kind of be treated like a configuration file, I guess. * - * All le + * All length units are relative to the size of a small ship module, which + * is always 1x1. */ +// For fixing floating point rounding errors. +export const EPSILON = 1e-8; // Unit length of sector. Only for internal representation. export const SECTOR_SIZE = 512; -// Star count per sector. -export const STAR_DENSITY = (SECTOR_SIZE ** 2) / 10000; // G, G-boy, The big G, Mr. G, g's big brother, G-dog export const GRAVITATIONAL_CONSTANT = 0.01; // Perspective constraints. Higher zoom value = closer. @@ -16,3 +17,10 @@ export const MIN_ZOOM = 1; export const MAX_ZOOM = 100; export const DEFAULT_ZOOM = 10; export const ZOOM_SPEED = 0.01; +// Ship landing. Angle in radians. +export const TIP_ANGLE = 30.3; +export const TIP_SPEED = 0.015; +// Ship flight mechanics. Speed measured in units per tick. +export const FUEL_BURN_RATE = 0.01; +// Distance at which an orbited planet will not be considered a parent body. +export const MAX_PARENT_CELESTIAL_DISTANCE = 120; diff --git a/js/game/control.mjs b/js/game/control.mjs index 0267289..b99ce3b 100644 --- a/js/game/control.mjs +++ b/js/game/control.mjs @@ -1,16 +1,36 @@ import * as input from '../input.mjs'; +import * as events from './events.mjs'; import * as player from './player.mjs'; +import * as graphics from '../graphics/index.mjs'; +import {state} from './index.mjs'; export const mapping = { thrust: 'KeyW', left: 'KeyA', - right: 'KeyD' + right: 'KeyD', + exitEdit: 'Escape' }; -export function tick() { - let held = input.keyCode.held; - let pressed = input.keyCode.pressed; +let held, pressed; +export function tick() { + held = input.keyCode.held; + pressed = input.keyCode.pressed; + + if (state.editing) { + tickEditing(); + } else if (state.playing) { + tickPlaying(); + } + + if (!state.editing) { + if (input.mouse.scroll !== 0) { + graphics.changeZoom(-input.mouse.scroll); + } + } +} + +function tickPlaying() { if (held[mapping.thrust]) { player.ship.applyThrust({ forward: 1 }); } @@ -23,3 +43,9 @@ export function tick() { player.ship.applyThrust({ turnRight: 1 }); } } + +function tickEditing() { + if (held[mapping.exitEdit]) { + events.endEditing(); + } +} diff --git a/js/game/edit.mjs b/js/game/edit.mjs new file mode 100644 index 0000000..4d40a80 --- /dev/null +++ b/js/game/edit.mjs @@ -0,0 +1,10 @@ +import * as game from './index.mjs'; +import * as graphics from '../graphics/index.mjs'; + +export function init() { + graphics.setZoom(20); +} + +export function end() { + +} diff --git a/js/game/events.mjs b/js/game/events.mjs index a3ba9f1..76c3804 100644 --- a/js/game/events.mjs +++ b/js/game/events.mjs @@ -2,8 +2,34 @@ import * as game from './index.mjs'; import * as graphics from '../graphics/index.mjs'; import * as world from '../world/index.mjs'; import * as player from './player.mjs'; +import * as edit from './edit.mjs'; + +export let shipLanded = false; export function startGame() { game.changeView('game'); graphics.perspective.focusPlayer(); } + +export function landShip() { + shipLanded = true; + game.state.landed = true; +} + +export function launchShip() { + shipLanded = false; + game.state.landed = false; +} + +export function editShip() { + console.log('a'); + graphics.changePerspective('parent', -5, 0); + game.state.editing = true; + edit.init(); +} + +export function endEditing() { + graphics.changePerspective('universe'); + game.state.editing = false; + edit.end(); +} diff --git a/js/game/index.mjs b/js/game/index.mjs index dc0cffb..7532d33 100644 --- a/js/game/index.mjs +++ b/js/game/index.mjs @@ -6,12 +6,15 @@ import * as world from '../world/index.mjs'; import * as events from './events.mjs'; import * as control from './control.mjs'; import * as player from './player.mjs'; +import * as edit from './edit.mjs'; export let state; export async function init() { state = { view: 'menu', + playing: false, + editing: false, paused: false }; @@ -36,6 +39,9 @@ export function changeView(view) { gui.changeView(view); if (view == 'game') { + state.playing = true; + state.editing = false; + state.paused = false; world.init(); player.init(); } diff --git a/js/game/inventory.mjs b/js/game/inventory.mjs new file mode 100644 index 0000000..e69de29 diff --git a/js/game/player.mjs b/js/game/player.mjs index aeec9e0..1f60798 100644 --- a/js/game/player.mjs +++ b/js/game/player.mjs @@ -1,4 +1,5 @@ import * as world from '../world/index.mjs'; +import * as inventory from './inventory.mjs'; export let ship; diff --git a/js/graphics/background.mjs b/js/graphics/background.mjs index a129b0b..8e4f9e7 100644 --- a/js/graphics/background.mjs +++ b/js/graphics/background.mjs @@ -11,58 +11,23 @@ function init() { }; } -export function render() { +export function render(angle) { if (patterns === null) init(); - renderLayer(patterns.back, 0.3, 1); - renderLayer(patterns.middle, 0.5, 0.3); - //renderLayer(patterns.front, 0.7, 0.3); + renderLayer(patterns.back, 0.3, 1, angle); + renderLayer(patterns.middle, 0.5, 0.3, angle); + //renderLayer(patterns.front, 0.7, 0.3, angle); } -function renderLayer(pattern, speed = 1, scale = 1) { +function renderLayer(pattern, speed = 1, scale = 1, angle = 0) { context.save(); + let outset = (Math.abs(Math.cos(angle)) + Math.abs(Math.sin(angle))); + outset = ((outset - 1) * canvas.width) / scale; let [px, py] = [perspective.x * speed, perspective.y * speed]; context.translate(-px, -py); context.scale(scale, scale); context.fillStyle = pattern; - context.fillRect(px / scale, py / scale, - canvas.width / scale, canvas.height / scale); + context.fillRect(px / scale - outset / 2, py / scale - outset / 2, + canvas.width / scale + outset, canvas.height / scale + outset); context.restore(); } - -/* -function renderSectorStars(sector) { - let rand = new SeededRandom(sector.numId); - - context.fillStyle = '#fff'; - - for (let i = 0; i < STAR_DENSITY; i++) { - let sx = rand.next() * sector.size + sector.wx; - let sy = rand.next() * sector.size + sector.wy; - context.fillRect(sx, sy, 1.5, 1.5); - } -} - -function tile(img, x, y, dx = 0, dy = 0, scale = 1) { - let [sx, sy] = [x * scale, y * scale]; - let [ex, ey] = [(x + canvas.width) * scale, (y + canvas.height) * scale]; - for (let x = sx; x < ex;) { - let nx = (Math.floor(x / img.width) + 1) * img.width; - nx = Math.min(nx, ex); - let w = nx - x; - - for (let y = sy; y < ey;) { - let ny = (Math.floor(y / img.height) + 1) * img.height; - ny = Math.min(ny, ey); - let h = ny - y; - - context.drawImage(img, x % img.width, y % img.height, w, h, - dx + x, dy + y, w, h); - - y = ny; - } - - x = nx; - } -} -*/ diff --git a/js/graphics/index.mjs b/js/graphics/index.mjs index dce9f2a..98d7e37 100644 --- a/js/graphics/index.mjs +++ b/js/graphics/index.mjs @@ -29,10 +29,10 @@ export function render() { context.fillStyle = '#000'; context.fillRect(0, 0, canvas.width, canvas.height); - renderBackground(); - context.save(); perspective.tick(); + perspective.transformRotate(); + renderBackground(perspective.rotation); perspective.transformCanvas(); renderWorld(); context.restore(); @@ -44,41 +44,108 @@ export function getVisibleSectors() { return world.getContainedSectors(...perspective.bounds); } +export function changePerspective(rotationMode, shiftX = 0, shiftY = 0) { + perspective.changeRotationMode(rotationMode); + perspective.changeShift(shiftX, shiftY); + perspective.transition = 1; +} + +export function changeZoom(delta) { + perspective.zoomDelta(delta); +} + +export function setZoom(target) { + perspective.changeZoom(target); +} + class Perspective { constructor() { this.x = 0; this.y = 0; + this.shiftX = 0; + this.shiftY = 0; + this.zoom = 0; this.bounds = [0, 0, canvas.width, canvas.height]; + this.rotationMode = 'universe'; + this.targetZoom = consts.DEFAULT_ZOOM; + this.oldTarget = 0; + this.oldShift = [0, 0]; + this.oldZoom = 0; + this.transition = 0; + this.zoomTransition = 0; this.reset(); } + changeRotationMode(mode) { + this.oldTarget = this.targetRotation; + this.rotationMode = mode; + } + + changeShift(x, y) { + this.oldShift = this.currentShift; + [this.shiftX, this.shiftY] = [x, y]; + } + + changeZoom(zoom) { + this.oldZoom = this.currentZoom; + this.targetZoom = zoom; + this.zoomTransition = 1; + } + + get currentShift() { + let [ox, oy] = this.oldShift; + return [this.interpolate(this.shiftX, ox), + this.interpolate(this.shiftY, oy)]; + } + + get currentRotation() { + return this.interpolate(this.targetRotation, this.oldTarget); + } + + get currentZoom() { + let t = this.zoomTransition; + return (this.oldZoom * t + this.targetZoom * (1 - t)); + } + + interpolate(cur, old, x = this.transition) { + return (old * x + cur * (1 - x)); + } + tick() { - if (input.mouse.scroll !== 0) { - this.zoomDelta(-input.mouse.scroll); - } - - if (this.focus !== null) { + if (this.focus !== null) [this.x, this.y] = this.focus.com; - } - if (this.rotationFocus !== null) { - this.targetRotation = this.rotationFocus.r; - } else { + if (this.focus === null || this.rotationMode === 'universe') { this.targetRotation = 0; + } else if (this.rotationMode === 'parent') { + let parent = this.focus.parentCelestial; + if (parent === null) { + this.targetRotation = 0; + } else { + let a = this.focus.angleTo(...this.focus.com, ...parent.com); + this.targetRotation = a - Math.PI / 2; + } + } else { + this.targetRotation = this.focus.r; } - if (this.smoothRotation) { - this.rotation = (this.rotation * 0.9 + this.targetRotation * 0.1); - } else { - this.rotation = this.targetRotation; - } + let dif = Math.abs(this.targetRotation - this.rotation); + this.rotationMet = dif < (this.rotationMet ? 0.3 : 0.05); + + this.rotation = this.currentRotation; + this.zoom = this.currentZoom; + + this.transition *= 0.9; + this.zoomTransition *= 0.9; + + this.normalize(); } reset() { this.rotation = 0; this.targetRotation = 0; - this.smoothRotation = false; this.zoom = consts.DEFAULT_ZOOM; + this.targetZoom = this.zoom; this.focus = null; this.rotationFocus = null; } @@ -86,24 +153,37 @@ class Perspective { focusPlayer() { this.focus = world.playerShip; this.rotationFocus = world.playerShip; - this.smoothRotation = false; } zoomDelta(delta) { let factor = 1 + (consts.ZOOM_SPEED * Math.abs(delta)); - this.zoom *= delta > 0 ? factor : 1 / factor; + this.targetZoom *= delta > 0 ? factor : 1 / factor; this.normalize(); } normalize() { - this.zoom = Math.max(consts.MIN_ZOOM, - Math.min(consts.MAX_ZOOM, this.zoom)); + this.targetZoom = Math.max(consts.MIN_ZOOM, + Math.min(consts.MAX_ZOOM, this.targetZoom)); + this.targetRotation %= (Math.PI * 2); + } + + transformRotate() { + let [,,bw, bh] = this.bounds; + context.translate(bw / 2, bh / 2); + context.rotate(-this.rotation); + context.translate(-bw / 2, -bh / 2); + } + + rotateVector(x, y, r = this.rotation) { + return [(x * Math.cos(r) - y * Math.sin(r)), + (y * Math.cos(r) - x * Math.sin(r))]; } transformCanvas() { let [,,bw, bh] = this.bounds; - let tx = -this.x * this.zoom; - let ty = -this.y * this.zoom; + let [sx, sy] = this.rotateVector(...this.currentShift, -this.rotation); + let tx = -(this.x + sx) * this.zoom; + let ty = -(this.y + sy) * this.zoom; context.translate(tx + bw / 2, ty + bh / 2); context.scale(this.zoom, this.zoom); } diff --git a/js/gui/button.mjs b/js/gui/button.mjs index 2613fcb..7b3d35f 100644 --- a/js/gui/button.mjs +++ b/js/gui/button.mjs @@ -8,4 +8,9 @@ export default class GuiButton extends GuiElement { this.text = text; this.onclick = onclick; } + + click() { + if (this.options.draw) + this.onclick(); + } } diff --git a/js/gui/element.mjs b/js/gui/element.mjs index 17aa69e..503479a 100644 --- a/js/gui/element.mjs +++ b/js/gui/element.mjs @@ -1,7 +1,8 @@ import {Rect} from './misc.mjs'; const defaultOptions = { - draw: true // Whether the element itself will be rendered. + draw: true, // Whether the element itself will be rendered. + drawChildren: true // Whether children will be rendered. } export default class GuiElement extends Rect { @@ -15,9 +16,14 @@ export default class GuiElement extends Rect { this.options = Object.assign({}, defaultOptions, options); } - tick() { + tickElement() { this.tickMouse(); - this.children.forEach(c => c.tick()); + this.tick(); + this.children.forEach(c => c.tickElement()); + } + + tick() { + } append(element) { diff --git a/js/gui/index.mjs b/js/gui/index.mjs index 723f56c..6c52482 100644 --- a/js/gui/index.mjs +++ b/js/gui/index.mjs @@ -11,7 +11,7 @@ export function init() { } export function tick() { - root.tick(); + root.tickElement(); } export function changeView(view) { diff --git a/js/gui/misc.mjs b/js/gui/misc.mjs index 69bb215..69d1577 100644 --- a/js/gui/misc.mjs +++ b/js/gui/misc.mjs @@ -11,10 +11,11 @@ export class Rect { this.mouseHeld = false; } + click() {} + tickMouse() { if (this.mouseHeld == true && !input.mouse.held[0] && this.mouseOver) - if (this.onclick !== null) - this.onclick(); + this.click(); if (!this.mouseHeld && input.mouse.pressed[0] && this.mouseOver) this.mouseHeld = true; if (!input.mouse.held[0]) diff --git a/js/gui/modules.mjs b/js/gui/modules.mjs index 1797c15..bfe7fcb 100644 --- a/js/gui/modules.mjs +++ b/js/gui/modules.mjs @@ -5,6 +5,7 @@ import GuiFrame from './frame.mjs'; import GuiImage from './image.mjs'; import GuiButton from './button.mjs'; import * as events from '../game/events.mjs'; +import {state} from '../game/index.mjs'; export function root() { return new GuiFrame(0, 0, canvas.width, canvas.height, { @@ -36,6 +37,14 @@ export function title() { export function game() { let shadow = root(); - + + let edit = new GuiButton('Edit rocket', events.editShip, 0, 0, 200); + shadow.append(edit); + edit.posRelative({ x: 0.5, xc: 0.5, y: 1 }); + edit.y -= 45; + edit.tick = () => { + edit.options.draw = state.landed && !state.editing; + } + return shadow; } diff --git a/js/world/celestial.mjs b/js/world/celestial.mjs index b68cadd..beafa4e 100644 --- a/js/world/celestial.mjs +++ b/js/world/celestial.mjs @@ -19,6 +19,10 @@ export default class Celestial extends Body { return [this.x + this.radius, this.y + this.radius]; } + get escapeVelocity() { + + } + tick() { } diff --git a/js/world/ship.mjs b/js/world/ship.mjs index 50816c8..15ad0d8 100644 --- a/js/world/ship.mjs +++ b/js/world/ship.mjs @@ -1,7 +1,10 @@ import Module from './module.mjs'; import Body from './body.mjs'; import * as world from './index.mjs'; +import * as consts from '../consts.mjs'; import * as particle from './particle.mjs'; +import * as events from '../game/events.mjs'; +import {state} from '../game/index.mjs'; export default class Ship extends Body { constructor(x, y) { @@ -10,6 +13,7 @@ export default class Ship extends Body { this.localCom = [0, 0]; this.modules = new Set(); this.maxRadius = 0; + this.landed = false; } get com() { @@ -17,9 +21,27 @@ export default class Ship extends Body { return [this.x + lx, this.y + ly]; } + get parentCelestial() { + let closest = null; + let closestDistance = 0; + + world.celestials.forEach(c => { + let dis = this.distanceTo(c); + if (closest === null || dis < closestDistance) { + closest = c; + closestDistance = dis; + } + }); + + if (closestDistance > consts.MAX_PARENT_CELESTIAL_DISTANCE) + return null; + + return closest; + } + tick() { this.tickMotion(); - this.tickGravity(world.celestials); + if (!this.landed) this.tickGravity(world.celestials); this.resolveCollisions(); this.modules.forEach(m => { @@ -29,6 +51,9 @@ export default class Ship extends Body { }); this.modules.forEach(m => m.reset()); + + if (events.shipLanded != this.landed) + this.landed ? events.landShip() : events.launchShip(); } addModule(x, y, properties, options) { @@ -55,6 +80,8 @@ export default class Ship extends Body { } resolveCollisions() { + this.landed = false; + world.celestials.forEach(c => { let dis = this.distanceTo(c); @@ -72,16 +99,22 @@ export default class Ship extends Body { let angleToCom = this.angleTo(...this.com, ...pos); let angle = angleToCom - theta; let [force] = this.rotateVector(0, 1, angle); - if (Math.abs(angle) < 0.3) { + if (Math.abs(angle) < consts.TIP_ANGLE) { force *= -1; } - this.rvel -= force * 0.015; + if (Math.abs(angle) < 0.003 + && Math.abs(this.rvel) < 0.001) { + this.landed = true; + this.rvel = 0; + this.r = theta - Math.PI / 2; + } + this.rvel -= force * consts.TIP_SPEED; } checkModuleCollision(module, body) { let p = this.getWorldPoint(...module.localCom); let dis = body.distanceTo({ com: p }); - if (dis < body.radius + 0.5) { + if (dis < body.radius + 0.5 + consts.EPSILON) { this.approach(body, dis - (body.radius + 0.5)); this.halt(); this.resolveCelestialCollision(p, body);