-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntranceRoom.py
More file actions
47 lines (37 loc) · 1.15 KB
/
EntranceRoom.py
File metadata and controls
47 lines (37 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# John Zelesny
# CS 110 Final Project
# This creates the object for the Entrance room
# 1's mean Yes, 0's mean no
class EntranceRoom:
# Initilizes the door and key in the room
def __init__(self):
self.__keyTable = 1
self.__lockedDoor = 1
# Changes the key to No (player pick up the key)
def takeKey(self):
self.__keyTable = 0
# Changes the door to No (player opens the door)
def openDoor(self):
self.__lockedDoor = 0
# Returns if key is taken
# Returns True if not taken
# Returns False if taken
def keyExists(self):
return self.__keyTable == 1
def reset(self):
self.__keyTable = 1
self.__lockedDoor = 1
# Returns if door is unlocked
# Returns True if locked
# Returns False if unlocked
def doorLocked(self):
return self.__lockedDoor == 1
def __str__(self):
return "Key: " + str(self.__keyTable) + "\n"\
"Door: " + str(self.__lockedDoor)
##test = EntranceRoom()
##print(test.__str__())
##test.takeKey()
##print(test.__str__())
##test.openDoor()
##print(test.__str__())