fix dropping so dropped at player location, fix limit to hold items to 10
This commit is contained in:
parent
acacbf2fa1
commit
ea1e906121
|
@ -155,7 +155,7 @@ function checkKeys(key){
|
|||
function pickup(){
|
||||
for (let i = 0; i < roomItems.length; i++){
|
||||
if ((player.position.x == roomItems[i].position.x) && (player.position.y == roomItems[i].position.y)){
|
||||
if (roomItems.length>10){
|
||||
if (roomItems.length<10){
|
||||
console.log("You take "+roomItems[i].name);
|
||||
|
||||
//add to player inventory
|
||||
|
@ -164,6 +164,7 @@ function pickup(){
|
|||
//now remove from room since owned by player now
|
||||
roomItems.splice(i, 1);
|
||||
} else {
|
||||
console.log(roomItems);
|
||||
console.log("Your backpack is already full");
|
||||
}
|
||||
}
|
||||
|
@ -245,8 +246,8 @@ function eatOrDrop(key){
|
|||
"description": inventory[key.full].description,
|
||||
"position":
|
||||
{
|
||||
"x": inventory[key.full].position.x,
|
||||
"y": inventory[key.full].position.y
|
||||
"x": player.position.x,
|
||||
"y": player.position.y
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user