Bug fixes

This commit is contained in:
asraelite 2018-03-09 20:07:31 +00:00
parent 17df8c0863
commit 8a0bf0ada9
10 changed files with 187 additions and 30 deletions

48
dist/improcket.min.js vendored
View file

@ -89,7 +89,7 @@ const modules = {
type: 'thruster',
id: 'heavy',
mass: 5,
value: 6,
value: 4,
connectivity: [true, false, false, false],
thrust: 40
},
@ -99,7 +99,7 @@ const modules = {
type: 'thruster',
id: 'advanced',
mass: 2,
value: 20,
value: 15,
connectivity: [true, false, false, false],
thrust: 30
}
@ -188,12 +188,12 @@ const images = {
on: 'modules/light_thruster_on.svg'
},
heavy: {
off: 'modules/light_thruster.svg',
on: 'modules/light_thruster_on.svg'
off: 'modules/heavy_thruster.svg',
on: 'modules/heavy_thruster_on.svg'
},
advanced: {
off: 'modules/light_thruster.svg',
on: 'modules/light_thruster_on.svg'
off: 'modules/advanced_thruster.svg',
on: 'modules/advanced_thruster_on.svg'
}
},
connector: {
@ -608,6 +608,7 @@ let onupdate = () => {};
function init$1() {
items.clear();
update();
}
function canToss() {
@ -1354,15 +1355,15 @@ function randomPlanet(x, y, {
type: type
});
for (let i = 0.1; i < 4; i += 1) {
if (Math.random() > ENTITY_SPAWN_RATE) {
for (let i = 0.1; i < 10; i += 0.5) {
if (Math.random() > 0.95) {
let e = randomEntity();
e.orbit(planet, i * radius, Math.random() * Math.PI * 2);
}
}
for (let i = 0; i < 5; i++) {
if (Math.random() > ENTITY_SPAWN_RATE || true) {
for (let i = 0; i < 10; i++) {
if (Math.random() > 0.7) {
let e = randomEntity();
e.orbit(planet, 1.5, Math.random() * Math.PI * 2);
e.gravity = false;
@ -1376,7 +1377,7 @@ function randomPlanet(x, y, {
function randomEntity(x, y) {
let entity;
if (Math.random() > 0.3) {
if (Math.random() > 0.5) {
entity = new Entity(x, y, 'fuelcan');
} else {
let type, id;
@ -1756,6 +1757,7 @@ function init$5() {
window.addEventListener('wheel', event => {
mouse.scroll = event.deltaY;
event.preventDefault();
});
window.addEventListener('contextmenu', event => {
@ -2702,8 +2704,8 @@ const TAU$1 = TAU;
let canvas, context, tempCanvas, tempContext;
let perspective;
let trace = false;
let markers = false;
let trace = true;
let markers = true;
function init$8() {
canvas = document.querySelector('#main');
@ -2797,6 +2799,8 @@ class Perspective {
this.targetZoom = DEFAULT_ZOOM;
this.oldTarget = 0;
this.oldShift = [0, 0];
this.shiftX = 0;
this.shiftY = 0;
this.oldZoom = 0;
this.transition = 0;
this.zoomTransition = 0;
@ -2939,7 +2943,9 @@ const mapping$1 = {
toggleTrace: 'KeyT',
toggleMarkers: 'KeyR',
toggleMusic: 'KeyM',
togglePause: 'KeyP'
togglePause: 'KeyP',
zoomIn: 'KeyZ',
zoomOut: 'KeyX'
};
let held, pressed;
@ -2956,7 +2962,17 @@ function tick$5() {
if (!state.editing) {
if (mouse.scroll !== 0) {
changeZoom(-mouse.scroll);
// Fix for Firefox.
let delta = mouse.scroll > 0 ? -50 : 50;
changeZoom(delta);
}
if (held[mapping$1.zoomIn]) {
changeZoom(-10);
}
if (held[mapping$1.zoomOut]) {
changeZoom(10);
}
if (pressed[mapping$1.togglePause] && !state.gameOver) {
@ -3055,6 +3071,8 @@ function changeView$1(view) {
state.editing = false;
state.paused = false;
init$3();
init$4();
perspective.reset();
init$1();
} else if (view === 'instructions') {
state.playing = false;