Add collectable items
This commit is contained in:
parent
826986cdbf
commit
69fee5e73d
10 changed files with 131 additions and 52 deletions
|
@ -2,6 +2,8 @@ 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 inventory from './inventory.mjs';
|
||||
import * as particle from '../world/particle.mjs';
|
||||
import * as edit from './edit.mjs';
|
||||
|
||||
export let shipLanded = false;
|
||||
|
@ -48,3 +50,12 @@ export function invalidTilePlacement() {
|
|||
export function tilePlacement() {
|
||||
// TODO: Play some audio.
|
||||
}
|
||||
|
||||
export function tossItem() {
|
||||
particle.createItemToss(world.playerShip);
|
||||
}
|
||||
|
||||
export function collectItem(type, id) {
|
||||
inventory.addItem(type, id);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {modules} from '../data.mjs';
|
||||
import {images as assets} from '../assets.mjs';
|
||||
import * as events from './events.mjs';
|
||||
|
||||
export const items = new Map();
|
||||
export let currentItem = null;
|
||||
|
@ -30,6 +31,7 @@ export function removeItem(type, id) {
|
|||
items.delete(mapId);
|
||||
currentItem = null;
|
||||
}
|
||||
events.tossItem();
|
||||
}
|
||||
|
||||
export function selectItem(type, id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue