From a206b3709c01de8004380c2df2bf1f2961cf8938 Mon Sep 17 00:00:00 2001 From: s444427 Date: Fri, 3 Apr 2020 15:47:08 +0200 Subject: [PATCH] Small improvements (matrix notation, prep to clear) --- src/main.py => main.py | 25 +++++++++++-------------- src/tile.py | 1 + src/waiter.py | 0 3 files changed, 12 insertions(+), 14 deletions(-) rename src/main.py => main.py (86%) create mode 100644 src/tile.py create mode 100644 src/waiter.py diff --git a/src/main.py b/main.py similarity index 86% rename from src/main.py rename to main.py index d2f1175..b0f4a48 100644 --- a/src/main.py +++ b/main.py @@ -29,8 +29,9 @@ class Waiter(pygame.sprite.Sprite): # TILE class Tile: - x_position = 0 - y_position = 0 + def __init__(self): + self.x_position = 0 + self.y_position = 0 # SETUP @@ -56,20 +57,19 @@ def drawBackground(): def matrix_creator(): - for y in range(15): - matrix.append([0] * 14) + for x in range(14): + matrix.append([0] * 15) - 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 + for x in range(14): + for y in range(15): + matrix[x][y] = Tile() + matrix[x][y].x_position = x + matrix[x][y].y_position = y waiterPly = Waiter() - -def main(): +if __name__ == "__main__": drawBackground() matrix_creator() @@ -94,6 +94,3 @@ def main(): waiterPly.update() pygame.display.flip() clock.tick(fps) - - -main() diff --git a/src/tile.py b/src/tile.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/tile.py @@ -0,0 +1 @@ + diff --git a/src/waiter.py b/src/waiter.py new file mode 100644 index 0000000..e69de29