This commit is contained in:
Adnovac 2019-03-19 10:08:38 +01:00
commit 9a4c77d82a
3 changed files with 33 additions and 0 deletions

16
game.py Normal file
View File

@ -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))

9
sprites/cell.py Normal file
View File

@ -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)

8
sprites/grass.py Normal file
View File

@ -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")