Add inventory
This commit is contained in:
parent
548fb99c8b
commit
469121e18a
8 changed files with 200 additions and 22 deletions
|
@ -2,13 +2,15 @@ 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 * as inventory from './inventory.mjs';
|
||||
import {state} from './index.mjs';
|
||||
|
||||
export const mapping = {
|
||||
thrust: 'KeyW',
|
||||
left: 'KeyA',
|
||||
right: 'KeyD',
|
||||
exitEdit: 'Escape'
|
||||
exitEdit: 'Escape',
|
||||
inventory: 'KeyE',
|
||||
};
|
||||
|
||||
let held, pressed;
|
||||
|
@ -42,6 +44,10 @@ function tickPlaying() {
|
|||
if (held[mapping.right]) {
|
||||
player.ship.applyThrust({ turnRight: 1 });
|
||||
}
|
||||
|
||||
if (pressed[mapping.inventory]) {
|
||||
state.inventory = !state.inventory;
|
||||
}
|
||||
}
|
||||
|
||||
function tickEditing() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue