Add inventory space limit

This commit is contained in:
asraelite 2018-03-07 17:41:51 +00:00
parent a11dfb9352
commit 0c63cb075b
5 changed files with 44 additions and 9 deletions

View file

@ -182,6 +182,10 @@ export function collectItem(type, id, name) {
notify('Collected fuel: +10');
return true;
} else {
if (inventory.usedSpace > inventory.capacity) {
notify('No space left in inventory', 60);
return false;
}
inventory.addItem(type, id);
audio.play('itemPickup');
score += 20;