Skip to content

created classes and take player input - #1

Open
Lydster wants to merge 3 commits into
masterfrom
lydia-thornton
Open

Lydster wants to merge 3 commits into
masterfrom
lydia-thornton

Conversation

@Lydster

@Lydster Lydster commented Jul 10, 2019

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/adv.py
# If input is valid, move the player and loop
player.travel(cmd)
if len(current_room.items) > 0:
player.items.extend(current_room.items)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be wrong but doesn't this automatically add items to the player's items when entering the room? Also every time the player enters the room, they get the duplicated items again?

Comment thread src/player.py
def addItem(self, item):
if item != None:
self.items.append(item)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use self.current_room to remove the item once player adds the item to their items from the room.

Comment thread src/player.py
if item.name == item_name:
self.items.remove(item)
return item

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When player removes item, I would add the item to the current room that they are in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants