Add inventory space limit
This commit is contained in:
parent
a11dfb9352
commit
0c63cb075b
5 changed files with 44 additions and 9 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue