As we add more features it's nice to have one or more rooms that is locked by default, and can be unlocked by the player later on. For this we can add a bool to check if is locked and don't allow movement if it's locked.
This will be the first real "special item" implementation. So we need to create and change some stuff accordingly.
Special items preparation
[x] To start we need to have a bool field to check if is special.
[x] Function: transfer item (char to char)
[x] Function: destroy item.
[x] Function: contains item?
[x] Tests for all the above
Key & door implementation
[x] Prevent movement to locked rooms
[x] Function: open door.
[x] Function: lock random room.
[x] Tests room locked/unlocked movement
[x] Unlock the room if character has the key item
Implemented but not being used for now:
One random door is locked at the start of the game
As we add more features it's nice to have one or more rooms that is locked by default, and can be unlocked by the player later on. For this we can add a
bool
to check if is locked and don't allow movement if it's locked.This will be the first real "special item" implementation. So we need to create and change some stuff accordingly.
Special items preparation
Key & door implementation
Implemented but not being used for now: One random door is locked at the start of the game