Bug fixes
This commit is contained in:
parent
17df8c0863
commit
8a0bf0ada9
10 changed files with 187 additions and 30 deletions
|
@ -25,12 +25,12 @@ export 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: {
|
||||
|
|
|
@ -89,7 +89,7 @@ export const modules = {
|
|||
type: 'thruster',
|
||||
id: 'heavy',
|
||||
mass: 5,
|
||||
value: 6,
|
||||
value: 4,
|
||||
connectivity: [true, false, false, false],
|
||||
thrust: 40
|
||||
},
|
||||
|
@ -99,7 +99,7 @@ export const modules = {
|
|||
type: 'thruster',
|
||||
id: 'advanced',
|
||||
mass: 2,
|
||||
value: 20,
|
||||
value: 15,
|
||||
connectivity: [true, false, false, false],
|
||||
thrust: 30
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ export const mapping = {
|
|||
toggleTrace: 'KeyT',
|
||||
toggleMarkers: 'KeyR',
|
||||
toggleMusic: 'KeyM',
|
||||
togglePause: 'KeyP'
|
||||
togglePause: 'KeyP',
|
||||
zoomIn: 'KeyZ',
|
||||
zoomOut: 'KeyX'
|
||||
};
|
||||
|
||||
let held, pressed;
|
||||
|
@ -34,7 +36,17 @@ export function tick() {
|
|||
|
||||
if (!state.editing) {
|
||||
if (input.mouse.scroll !== 0) {
|
||||
graphics.changeZoom(-input.mouse.scroll);
|
||||
// Fix for Firefox.
|
||||
let delta = input.mouse.scroll > 0 ? -50 : 50;
|
||||
graphics.changeZoom(delta);
|
||||
}
|
||||
|
||||
if (held[mapping.zoomIn]) {
|
||||
graphics.changeZoom(-10);
|
||||
}
|
||||
|
||||
if (held[mapping.zoomOut]) {
|
||||
graphics.changeZoom(10);
|
||||
}
|
||||
|
||||
if (pressed[mapping.togglePause] && !state.gameOver) {
|
||||
|
|
|
@ -40,6 +40,8 @@ export function changeView(view) {
|
|||
state.editing = false;
|
||||
state.paused = false;
|
||||
world.init();
|
||||
edit.init();
|
||||
graphics.perspective.reset();
|
||||
inventory.init();
|
||||
} else if (view === 'instructions') {
|
||||
state.playing = false;
|
||||
|
|
|
@ -14,6 +14,7 @@ let onupdate = () => {};
|
|||
|
||||
export function init() {
|
||||
items.clear();
|
||||
update();
|
||||
}
|
||||
|
||||
export function canToss() {
|
||||
|
|
|
@ -10,8 +10,8 @@ const TAU = consts.TAU;
|
|||
|
||||
export let canvas, context, tempCanvas, tempContext;
|
||||
export let perspective;
|
||||
export let trace = false;
|
||||
export let markers = false;
|
||||
export let trace = true;
|
||||
export let markers = true;
|
||||
|
||||
export function init() {
|
||||
canvas = document.querySelector('#main');
|
||||
|
@ -109,6 +109,8 @@ class Perspective {
|
|||
this.targetZoom = consts.DEFAULT_ZOOM;
|
||||
this.oldTarget = 0;
|
||||
this.oldShift = [0, 0];
|
||||
this.shiftX = 0;
|
||||
this.shiftY = 0;
|
||||
this.oldZoom = 0;
|
||||
this.transition = 0;
|
||||
this.zoomTransition = 0;
|
||||
|
|
|
@ -45,6 +45,7 @@ export function init() {
|
|||
|
||||
window.addEventListener('wheel', event => {
|
||||
mouse.scroll = event.deltaY;
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
window.addEventListener('contextmenu', event => {
|
||||
|
|
|
@ -80,15 +80,15 @@ function randomPlanet(x, y, {
|
|||
type: type
|
||||
});
|
||||
|
||||
for (let i = 0.1; i < 4; i += 1) {
|
||||
if (Math.random() > consts.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() > consts.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;
|
||||
|
@ -102,7 +102,7 @@ function randomPlanet(x, y, {
|
|||
function randomEntity(x, y) {
|
||||
let entity, type, id;
|
||||
|
||||
if (Math.random() > 0.3) {
|
||||
if (Math.random() > 0.5) {
|
||||
entity = new Entity(x, y, 'fuelcan');
|
||||
} else {
|
||||
let type, id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue