class GameServer(object): def __init__(self): self.game = Game() self.ts = datetime.datetime.now() def move(self, item: int, x: int, y: int): return self.game.moveItem(item, Coord(x, y)) def to_json(self): info = self.game.to_json() info['ts'] = f'{self.ts}' return info
def main(): game = Game(1024, 720, "PygameTemplate") game.start() while game.running: game.clock.tick(game.FPS) for event in pygame.event.get(): if event.type == pygame.QUIT: game.running = False game.logic() game.render(game.win)
def main(): g = Game((1024, 700), "Pew Pew!") clock = pygame.time.Clock() fps = 60 while True: clock.tick(fps) for event in pygame.event.get(): if event.type == pygame.QUIT: return g.input(pygame.key.get_pressed()) g.update(clock.get_time() / 1000) g.render(g.win)
def __init__(self): self.game = Game() self.ts = datetime.datetime.now()
from game.main import Game game = Game() game.play()
def startGame(): game = Game() game.play()
def __init__(self): tiles = self.fillTiles() field = Field(template=Template(generator=ClassicGenerator()), tilePack=Pack(listGenerator(tiles))) Game.__init__(self, field)