commit 9a4c77d82afe8afc73b15421868636a0534191e9 Author: Adnovac Date: Tue Mar 19 10:08:38 2019 +0100 First diff --git a/game.py b/game.py new file mode 100644 index 0000000..bd1d960 --- /dev/null +++ b/game.py @@ -0,0 +1,16 @@ +from pygame import * +from sprites.grass import Grass +cells = [] +FPS = 5 +cell_size = 64 + +PLAY_WIDTH = 640 +PLAY_HEIGHT = 640 +WINDOW_WIDTH = PLAY_WIDTH + 100 +WINDOW_HEIGHT = PLAY_HEIGHT + 100 + + +for x in range(WINDOW_HEIGHT//64): + cells.append([]) + for y in range(WINDOW_HEIGHT//64): + cells[x].append(grass(x,y)) diff --git a/sprites/cell.py b/sprites/cell.py new file mode 100644 index 0000000..7eb962e --- /dev/null +++ b/sprites/cell.py @@ -0,0 +1,9 @@ +from pygame import * +import sys +from pygame.locals import * +class Cell(pygame.sprite.Sprites): + def __init__(self,x,y): + sprite.Sprite.__init__(self) + self.x = x + self.y = y + self.rect = pygame.Rect(x*64,y*64, 64,64) diff --git a/sprites/grass.py b/sprites/grass.py new file mode 100644 index 0000000..e75e6ed --- /dev/null +++ b/sprites/grass.py @@ -0,0 +1,8 @@ +from pygame import * +import sys +from cell import Cell + +class Grass(Cell): + def __init__(x,y): + Cell.__init__(self,x,y) + self.image = pygame.image.load("/images/grass.png")