Example #1
0
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)
Example #3
0
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)
Example #4
0
 def __init__(self):
     self.game = Game()
     self.ts = datetime.datetime.now()
Example #5
0
from game.main import Game

game = Game()

game.play()
Example #6
0
def startGame():
    game = Game()

    game.play()
Example #7
0
 def __init__(self):
     tiles = self.fillTiles()
     field = Field(template=Template(generator=ClassicGenerator()),
                   tilePack=Pack(listGenerator(tiles)))
     Game.__init__(self, field)