Skip to content

Commit

Permalink
Pocket append and drop are on the basis of itemname
Browse files Browse the repository at this point in the history
  • Loading branch information
DhruvaSambrani committed Mar 29, 2022
1 parent 46aa85a commit 8b931fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion docs/items.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ code_file: "[string]"

Pocket is a list of items that are "collected" by the user. This can be used to record what the user has seen, or to retain items which may be useful for the user to progress in the game. Pocket items can be [reinteracted](#interaction) with. Items can be marked as collectable in the [`.item` file](#.item-files) or can be added manually via [code file](#item-coding).

The game always starts with no items in the `Pocket`.
The game always initializes with no items in the `Pocket`.

The function

```py
Pocket.append(itemname, game)
Pocket.remove(itemname, game)
```

## Interaction

Expand Down
8 changes: 4 additions & 4 deletions tetra/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def show_desc(self, win, name):
[win[f"desc_{i.name}"].update(visible = False) for i in self.itemlist]
win[f"desc_{name}"].update(visible = True)

def append(self, item):
self.itemlist.append(item)
def append(self, itemname, game):
self.itemlist.append(game.item(itemname))

def drop(self, item):
self.remove(item)
def drop(self, itemname, game):
self.itemlist.remove(game.item(itemname))

0 comments on commit 8b931fa

Please sign in to comment.