-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.py
94 lines (75 loc) · 2.78 KB
/
start.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
# Support for using Python3 features in Python2(.7)
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# Support for using Python3 range and input in Python2(.7)
from six.moves import range
from six.moves import input
# Import game dependencies
from Room import *
from BossRoom import *
from Player import *
from Artifact import *
name = input('Whats your name? ')
player = Player()
print('Welcome to Chigsaw, ' + name + '.')
print('Sorry for no graphics, its my first game after all=)')
rooms = [[0 for x in range(3)] for x in range(3)]
rooms[0][0] = Room('Room 0.0','You must have used cheats!', False, None)
rooms[0][1] = Room('Spiky Wheely Room', 'You were killed by rolling spiked wheels. R.I.P.', True, None)
rooms[0][2] = Room('Room 0.2', 'This room is still kinda in development.', False, None)
rooms[1][0] = Room('Bear Room', 'You were eaten by a bear. R.I.P.', True, None)
rooms[1][1] = Room('Start Room', 'This is the room you start in.', False, None)
rooms[1][2] = Room('Room 1.2', 'This room is still kinda in development.', False, None)
rooms[2][0] = BossRoom('Boss Room', 'Kill the boss and win the game!', False, None)
rooms[2][1] = Room('Room 2.1', 'The right is the right way to go!', False, None)
rooms[2][2] = Room('Room 2.2', 'You got an Artifact that makes your attack stronger!', False, Artifact('Attack Buff'))
x = 1
y = 1
dead = 0
mandatoryActions = ['quit']
actionList = ['forward', 'back', 'left', 'right']
while not dead:
print(' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ')
print('Current room: ' + rooms[x][y].getName())
print(rooms[x][y].getText())
print('')
if rooms[x][y].hasArtifact():
artifact = rooms[x][y].getArtifact()
player.takeArtifact(artifact)
tmpActionList = mandatoryActions
if rooms[x][y].canGoOut():
tmpActionList = tmpActionList + actionList + rooms[x][y].getActionList()
else:
tmpActionList = tmpActionList + rooms[x][y].getActionList()
dead = rooms[x][y].isDeadly()
if dead:
continue
action = input('Type your action (%s): ' % ', '.join(tmpActionList))
actionProcessed = rooms[x][y].act(action, player)
dead = rooms[x][y].isDeadly()
if not actionProcessed and rooms[x][y].canGoOut():
if action == "forward":
if y > 0:
y = y-1
actionProcessed = True
elif action == "left":
if x > 0:
x = x-1
actionProcessed = True
elif action == "right":
if x < 2:
x = x+1
actionProcessed = True
elif action == "back":
if y < 2:
y = y+1
actionProcessed = True
if action == "quit":
dead = True
actionProcessed = True
continue
if not actionProcessed:
print('Sorry, I did not get you.')
print('Game over!')