-
Notifications
You must be signed in to change notification settings - Fork 0
/
sampleField.py
72 lines (56 loc) · 1.75 KB
/
sampleField.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
import random
from Game import Field
from Game.Objects import Money, Wall, TargetTreasure, Exit, Door, FogOfWar
from Game.Objects import VaultDoor
from Game.Characters import Guard
width = 30
height = 20
def randomCode(length):
return random.sample(range(0, 10), length)
def create(enemyManager):
field = Field(width, height)
for x in range(0, width):
field.addObject(x, 0, Wall())
if x == 3:
field.addObject(x, height - 1, Exit())
else:
field.addObject(x, height - 1, Wall())
for y in range(1, height - 1):
field.addObject(0, y, Wall())
field.addObject(width - 1, y, Wall())
# Starting room
for x in range(1, 8):
field.addObject(x, 8, Wall())
for y in range(1, 8):
if y != 5:
field.addObject(7, y, Wall())
# Middle wall
for y in range(1, height - 1):
if y == 15:
field.addObject(15, y, Door())
else:
field.addObject(15, y, Wall())
# Top right room
for x in range(16, width - 1):
if x == width - 3:
field.addObject(x, 6, Door())
else:
field.addObject(x, 6, Wall())
# Vault
for y in range(1, 6):
if y == 3:
field.addObject(21, y, VaultDoor(randomCode(4)))
else:
field.addObject(21, y, Wall())
for y in range(2, 5):
field.addObject(19, y, Money(10))
field.addObject(17, 3, TargetTreasure())
# Fog of war
for x in range(1, width - 1):
for y in range(1, height - 1):
field.addObject(x, y, FogOfWar())
# Enemies
enemyManager.addEnemy(Guard(field, 12, 4))
enemyManager.addEnemy(Guard(field, 3, 15))
enemyManager.addEnemy(Guard(field, 17, 17))
return field