forked from s464965/WMICraft
refactor: cleaner constants
This commit is contained in:
parent
9c23ea4a3d
commit
e81dd05024
9
constants.py
Normal file
9
constants.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
GAME_TITLE = 'WMICraft'
|
||||||
|
WINDOW_HEIGHT = 900
|
||||||
|
WINDOW_WIDTH = 900
|
||||||
|
GRID_CELL_PADDING = 3
|
||||||
|
GRID_CELL_WIDTH = 42
|
||||||
|
GRID_CELL_HEIGHT = 42
|
||||||
|
ROWS = 20
|
||||||
|
COLUMNS = 20
|
||||||
|
FPS_COUNT = 60
|
12
game.py
12
game.py
@ -2,17 +2,7 @@ import pygame
|
|||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
from grid import Grid
|
from grid import Grid
|
||||||
|
from constants import GAME_TITLE, WINDOW_WIDTH, WINDOW_HEIGHT, FPS_COUNT
|
||||||
GAME_TITLE = 'WMICraft'
|
|
||||||
WINDOW_HEIGHT = 900
|
|
||||||
WINDOW_WIDTH = 900
|
|
||||||
GRID_CELL_PADDING = 3
|
|
||||||
GRID_CELL_WIDTH = 42
|
|
||||||
GRID_CELL_HEIGHT = 42
|
|
||||||
ROWS = 20
|
|
||||||
COLUMNS = 20
|
|
||||||
FPS_COUNT = 60
|
|
||||||
GREEN = (0, 255, 0)
|
|
||||||
|
|
||||||
|
|
||||||
class Game:
|
class Game:
|
||||||
|
6
grid.py
6
grid.py
@ -2,11 +2,7 @@ import pygame
|
|||||||
import random
|
import random
|
||||||
from field import Field
|
from field import Field
|
||||||
|
|
||||||
GRID_CELL_PADDING = 3
|
from constants import ROWS, COLUMNS, GRID_CELL_PADDING, GRID_CELL_WIDTH, GRID_CELL_HEIGHT
|
||||||
GRID_CELL_WIDTH = 42
|
|
||||||
GRID_CELL_HEIGHT = 42
|
|
||||||
ROWS = 20
|
|
||||||
COLUMNS = 20
|
|
||||||
|
|
||||||
|
|
||||||
class Grid:
|
class Grid:
|
||||||
|
Loading…
Reference in New Issue
Block a user