Skip to content

Commit 319645d

Browse files
committed
append shovel-ed Walls to Inventory
1 parent 7713f3b commit 319645d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Actors/Actor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export abstract class Actor extends GameObject {
1313

1414
public equipt: Item;
1515

16-
public inventory: Item[];
16+
public inventory: GameObject[];
1717

1818
public debug: boolean = false;
1919

src/Items/Shovel.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ class ShovelAction extends Action {
3737
toPosY = this.actor.y;
3838
}
3939

40-
// TODO: this is where you add something to inventory
41-
// Change this to "DirtWall" or "DiggableWall"... do we want to be able to dig out any walls?
4240
if (room.objects[toPosX][toPosY] instanceof Wall) {
43-
// this.actor.inventory.add(room.objects[toPosX][toPosY]);
41+
// Add the wall to the actors inventory
42+
this.actor.inventory.push(room.objects[toPosX][toPosY]);
43+
44+
// Put a floor tile where the Wall that we just dug was
4445
room.objects[toPosX][toPosY] = new Floor(toPosX, toPosY, room.floorTile);
4546
return true;
4647
}
48+
4749
return false;
48-
4950
}
5051
}
5152

0 commit comments

Comments
 (0)