-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVersion2.py
246 lines (161 loc) · 10 KB
/
Version2.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# -*- coding: utf-8 -*-
import Tkinter, tkFont
from Tkinter import *
import sys
import random
import timeit
import time
import pickle
root = Tkinter.Tk()
root.title('Apocalyptic City')
#INVENTORY
inventory = []
#INVENTORY
def addToInventory(item):
item = raw_input('> what do you want to add?? ')
inventory.append(item)
canvas = Tkinter.Canvas(root, height = 200, width = 900, relief = Tkinter.RAISED, bg= 'black')
canvas.grid()
canvas2 = Tkinter.Canvas(root, height = 300, width = 900, relief = Tkinter.RAISED, bg = 'red')
canvas2.grid()
#----------------------------------------------------------------------------------INTRO---------------------------------------------------------------------------------------------------------------------------
message = canvas.create_text(380, 90, text = 'Welcome to Apocalyptic City!', fill = 'white', font = ('Toxico', -40))
message2 = canvas2.create_text(470, 140, text = 'Your objective in this game will be to\nget out of the building to saftey to\na certain destination.\n', fill = 'black', font = ('True Lies', -40))
#-------------------------------------------------WRONG WAY---------------------------------------------------------------------
def wrong_way():
root = Tkinter.Tk()
root.title('WRONG WAY')
canvas = Tkinter.Canvas(root, height = 200, width = 900, relief = Tkinter.RAISED, bg= 'black')
canvas.grid()
message = canvas.create_text(300, 100, text = ' You can\'t go that way!',fill = 'red', font = ('Yu Gothic', -50))
print message
#---------------------------------------------------OFFICE------------------------------------------------------------
#2
def newWindow():
#global message
root = Tkinter.Tk()
root.title('Room: Office')
canvas = Tkinter.Canvas(root, height = 100, width = 990, relief = Tkinter.RAISED, bg= 'black')
canvas.grid()
canvas2 = Tkinter.Canvas(root, height = 390, width = 990, relief = Tkinter.RAISED, bg = 'red')
canvas2.grid()
message1 = canvas.create_text(300, 60, text = 'Room: Office', fill = 'white', font = ('Yu Gothic', -30))
print message1
message = canvas2.create_text(400, 200, text = 'Papers are shattered everywhere. The lights\nare flashing on and off. Next to you is a\nblue paper.\n\nIt reads: *Escape to the labatory hidden under\nan old facotry building.It should be located a\ncouple of blocks west of where you are located.*\n\nHead north or east', fill = 'black', font = ('Yu Gothic', -30))
print message
button = Tkinter.Button(root, text= 'North', width = 10, height = 5, command = con_room)
button.grid(row = 1, column= 4)
button = Tkinter.Button(root, text= 'East', width = 10, height = 5, command = desk)
button.grid(row = 1, column= 5)
button = Tkinter.Button(root, text= 'South', width = 10, height = 5, command = wrong_way)
button.grid(row = 3, column= 4)
button = Tkinter.Button(root, text= 'West', width = 10, height = 5, command = wrong_way)
button.grid(row = 3, column= 5)
button = Tkinter.Button(root, text= 'QUIT', width = 10, height = 5, command = root1.destroy)
button.grid(row = 1, column= 6)
#---------------------------------------------------------INTRO------------------------------------------------------------------
#START OF THE GAME
button = Tkinter.Button(root, text= 'START GAME', width = 10, height = 5, command = newWindow)
button.grid(row = 0, column= 1)
button = Tkinter.Button(root, text= 'QUIT', width = 10, height = 5, command = root.destroy)
button.grid(row = 0, column= 2)
#------------------------------------------------------------CON./NORTH----------------------------------------------------------------------
#3
def con_room():
root = Tkinter.Tk()
root.title('Room: Conference Room')
editor = Tkinter.Text(master = root, width= 45, height = 0)
editor.grid( row= 0 , column = 0, sticky = (Tkinter.N, Tkinter.W, Tkinter.E))
editor.insert(Tkinter.END,"add?")
editor.see(Tkinter.END)
canvas = Tkinter.Canvas(root, height = 100, width = 990, relief = Tkinter.RAISED, bg= 'black')
canvas.grid()
canvas2 = Tkinter.Canvas(root, height = 400, width = 990, relief = Tkinter.RAISED, bg = 'red')
canvas2.grid()
message = canvas.create_text (200, 60, text = 'Room: Conference Room', fill = 'white', font = ('Yu Gothic', -30))
print message
message1 = canvas2.create_text(500, 200, text = 'You are now standing in the Conference Room. Decomposing\nbodies are laying ageround. The smell of rotting human flesh is\nmaking you sick. There\'s a flashlight on the table. Pick it up...you\nmight need it later on.\n\nTo add an item type in...\n\n>add\n\nAfter head "east"', fill = 'black', font = ('Yu Gothic', -30))
print message1
if editor == "add":
addToInventory(input)
print(inventory)
print
#BUTTONS "LOCATIONS"
button = Tkinter.Button(root, text= 'North', width = 10, height = 5, command = wrong_way)
button.grid(row = 2, column= 3)
button = Tkinter.Button(root, text= 'East', width = 10, height = 5, command = elevator)
button.grid(row = 2, column= 6)
button = Tkinter.Button(root, text= 'South', width = 10, height = 5, command = newWindow)
button.grid(row = 3, column= 3)
button = Tkinter.Button(root, text= 'West', width = 10, height = 5, command = wrong_way)
button.grid(row = 3, column= 6)
button = Tkinter.Button(root, text= 'QUIT', width = 10, height = 5, command = root2.destroy)
button.grid(row = 5, column= 4)
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def desk():
root = Tkinter.Tk()
root.title('Location: Secutary Desk')
canvas = Tkinter.Canvas(root, height = 100, width = 990, relief = Tkinter.RAISED, bg= 'black')
canvas.grid()
canvas2 = Tkinter.Canvas(root, height = 350, width = 990, relief = Tkinter.RAISED, bg = 'red')
canvas2.grid()
message = canvas.create_text(300, 60, text = 'Location: Secutrary Desk', fill = 'white', font = ('Yu Gothic', -30))
print message
message2 = canvas2.create_text(450, 150, text = 'You are standing next to your securary\'s desk. A "flashlight"\nstands on top. Pick it up you might need it later on.\n\nType\n>add\n\nAfter head either "north" to the elevator or "east" to the stairs.', fill = 'black', font = ('Yu Gothic', -30))
print message2
#BUTTONS "LOCATIONS"
button = Tkinter.Button(root, text= 'North', width = 10, height = 5, command = elevator)
button.grid(row = 0, column= 4)
button = Tkinter.Button(root, text= 'East', width = 10, height = 5, command = stairs)
button.grid(row = 0, column= 5)
button = Tkinter.Button(root, text= 'South', width = 10, height = 5, command = wrong_way)
button.grid(row = 1, column= 4)
button = Tkinter.Button(root, text= 'West', width = 10, height = 5, command = newWindow)
button.grid(row = 1, column= 3)
button = Tkinter.Button(root, text= 'QUIT', width = 10, height = 5, command = root3.destroy)
button.grid(row = 5, column= 4)
#---------------------------------------------------------------------------------------------------------------------------------------------
def stairs():
root = Tkinter.Tk()
root.title("Location: Stairs")
canvas = Tkinter.Canvas(root, height = 200, width = 900, relief = Tkinter.RAISED, bg= 'black')
canvas.grid()
canvas2 = Tkinter.Canvas(root, height = 350, width = 990, relief = Tkinter.RAISED, bg = 'red')
canvas2.grid()
message = canvas2.create_text(300, 100, text = 'Location: Stairs', fill = 'green', font = ('Yu Gothic', -50))
print message
message2 = canvas2.create_text(300, 100, text = 'You need to restore to full health.There is a green serum laying on the ground. \n\nType "restore".\n\nThis will get you to full health.\nAfter head "down".', fill = 'green', font = ('Yu Gothic', -50))
print message2
#BUTTONS "LOCATIONS"
button = Tkinter.Button(root, text= 'North', width = 10, height = 5, command = newWindow)
button.grid(row = 0, column= 5)
button = Tkinter.Button(root, text= 'East', width = 10, height = 5, command = newWindow)
button.grid(row = 0, column= 5)
button = Tkinter.Button(root, text= 'South', width = 10, height = 5, command = newWindow)
button.grid(row = 3, column= 4)
button = Tkinter.Button(root, text= 'West', width = 10, height = 5, command = newWindow)
button.grid(row = 2, column= 3)
button = Tkinter.Button(root, text= 'QUIT', width = 10, height = 5, command = root4.destroy)
button.grid(row = 5, column= 4)
def elevator():
root = Tkinter.Tk()
root.title("Location: Elevator")
canvas = Tkinter.Canvas(root, height = 200, width = 900, relief = Tkinter.RAISED, bg= 'black')
canvas.grid()
canvas2 = Tkinter.Canvas(root, height = 350, width = 990, relief = Tkinter.RAISED, bg = 'red')
canvas2.grid()
message= canvas.create_text
message = canvas2.create_text(300, 100, text = 'Papers are shattered everywhere. The lights are flashing on and off. Next to you is a blue paper.\n\nType in "pick up" to read what it says.', fill = 'green', font = ('Yu Gothic', -50))
print message
#BUTTONS "LOCATIONS"
button = Tkinter.Button(root4, text= 'North', width = 10, height = 5, command = newWindow)
button.grid(row = 0, column= 5)
button = Tkinter.Button(root4, text= 'East', width = 10, height = 5, command = newWindow)
button.grid(row = 0, column= 5)
button = Tkinter.Button(root4, text= 'South', width = 10, height = 5, command = newWindow)
button.grid(row = 3, column= 4)
button = Tkinter.Button(root4, text= 'West', width = 10, height = 5, command = newWindow)
button.grid(row = 2, column= 3)
button = Tkinter.Button(root4, text= 'QUIT', width = 10, height = 5, command = root4.destroy)
button.grid(row = 5, column= 4)
root.mainloop()