forked from mcgillij/pyDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaptile.py
More file actions
52 lines (43 loc) · 1.29 KB
/
maptile.py
File metadata and controls
52 lines (43 loc) · 1.29 KB
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
try:
import pygame
from pygame.locals import *
import loader
from item import Item
except ImportError, 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.image, self.rect = loader.load_png(imagename)
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):
oldvalue = self.value
# self.image, self.rect = loader.load_png(image)
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 == True:
val = item
self.remove(item)
return val
return None