-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
73 lines (54 loc) · 2.05 KB
/
main.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from room import Room
from character import Enemy
# Setting room names and descriptions
kitchen = Room("Kitchen")
kitchen.set_description("A dank and dirty room buzzing with flies")
ballroom = Room("Ballroom")
ballroom.set_description("A vast room with a shiny wooden floor")
dining_hall = Room("Dining hall")
dining_hall.set_description("A large room with ornate golden decorations")
# Linking the rooms
kitchen.link_room(dining_hall, "south")
dining_hall.link_room(kitchen, "north")
dining_hall.link_room(ballroom, "west")
ballroom.link_room(dining_hall, "east")
#Creating a new character Dave from the Enemy child class
dave = Enemy("Dave", "A smelly zombie\n")
dave.set_conversation("Hello! I'm Dave, I'm not a zombie, I swear to God!")
dave.set_weakness("cheese")
#Creating a new character Dave from the Enemy child class
anne = Enemy("Anne", "Not the most friendly person...\n")
anne.set_conversation(None)
anne.set_weakness("None")
# Loop allowing the player to move between the rooms
current_room = ballroom
while True:
print("\n")
current_room.get_details()
inhabitant = current_room.get_character()
command = input("> ")
current_room = current_room.move(command)
# Placing Dave character into the dinning hall
if current_room == dining_hall:
print("\n")
dave.describe()
dave.talk()
fight_with = input("What will you fight with?\n> ")
dave.fight(fight_with)
if current_room == kitchen:
print("\n")
anne.describe()
anne.talk()
# Rooms Plan #####################
# #
#N # #
#W #E # Kitchen #
#S # #
# #
############################## #########
# # #
# # #
# Ballroom # Dining Hall #
# #
# # #
#########################################