-
Notifications
You must be signed in to change notification settings - Fork 4
/
maptile.py
47 lines (38 loc) · 1.09 KB
/
maptile.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
try:
import sys
from item import Item
except ImportError as err:
print("couldn't load module. %s" % (err))
sys.exit(2)
class MapTile:
""" MapTile class, generic class for a tile """
def __init__(self, value):
self.value = value
self.content = []
self.mobs = []
if int(self.value) == int(0) or int(self.value) == int(5):
self.blocked = True
else:
self.blocked = False
def digTile(self, value):
self.value = value
self.add(Item("crumbledwall", 16))
def addMob(self, mob):
self.mobs.append(mob)
return self.mobs
def removeMob(self, mob):
self.mobs.append(mob)
return self.mobs
def add(self, content):
self.content.append(content)
return self.content
def remove(self, content):
self.content.remove(content)
return self.content
def pickup(self):
for item in self.content:
if item.selected:
val = item
self.remove(item)
return val
return None