1
0
forked from s434673/AI_Waiter

Matrix of objects (class Tile)

This commit is contained in:
s444427 2020-04-03 00:36:09 +02:00
parent 5eb280929d
commit 12ecd02a27

View File

@ -27,6 +27,12 @@ class Waiter(pygame.sprite.Sprite):
screen.blit(self.imageWaiter, (self.moveX * block_size, self.moveY * block_size)) screen.blit(self.imageWaiter, (self.moveX * block_size, self.moveY * block_size))
# TILE
class Tile:
x_position = 0
y_position = 0
# SETUP # SETUP
pygame.init() pygame.init()
screen = pygame.display.set_mode((700, 750)) screen = pygame.display.set_mode((700, 750))
@ -40,6 +46,7 @@ rect = 1
floor = pygame.image.load('../resources/images/floor.jpg') floor = pygame.image.load('../resources/images/floor.jpg')
table = pygame.image.load('../resources/images/table.png') table = pygame.image.load('../resources/images/table.png')
waiter = pygame.image.load('../resources/images/waiter.png') waiter = pygame.image.load('../resources/images/waiter.png')
matrix = []
def drawBackground(): def drawBackground():
@ -48,11 +55,23 @@ def drawBackground():
screen.blit(floor, (x * block_size, y * block_size)) screen.blit(floor, (x * block_size, y * block_size))
def matrix_creator():
for y in range(15):
matrix.append([0] * 14)
for y in range(15):
for x in range(14):
matrix[y][x] = Tile()
matrix[y][x].x_position = x
matrix[y][x].y_position = y
waiterPly = Waiter() waiterPly = Waiter()
def main(): def main():
drawBackground() drawBackground()
matrix_creator()
while not done: while not done:
for event in pygame.event.get(): for event in pygame.event.get():