First
This commit is contained in:
commit
9a4c77d82a
16
game.py
Normal file
16
game.py
Normal 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
9
sprites/cell.py
Normal 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
8
sprites/grass.py
Normal 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")
|
Loading…
Reference in New Issue
Block a user