• Post Reply Bookmark Topic Watch Topic
  • New Topic

Zuul Locked Door  RSS feed

 
Chan Duller
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ex. 6.44: Add locked exits to your game. The player needs to find (or otherwise obtain) a key to unlock the exit and enter a room. (You don't need to add a new class for doors or exits to your game). Make this as general as possible - in any room, any exit could potentially be locked.

I have no idea how to do this. One idea was to make a HashMap with direction as keys and boolean (true/false) as values. Any suggestions?

 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by explaining in words of one syllable how you are going to unlock the door. Write it down with a pencil (so you can destroy the evidence when you get it wrong ‍). See where that leads you.
 
Chan Duller
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, one room could have the key item stored in it. So when you reach that room, you can collect it and use it to unlock the exit that is locked.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!