Esempio n. 1
0
from game import pg, Screen, GameObject, InterfaceObject, Player, GameEngine
from game.assets import imgsetb, imgsety, maps, imgwall
from game.constants import gspeed, gunity

screen = Screen()
background = pg.transform.scale(pg.image.load('assets/img/background.jpg'),
                                (60 * gunity, 30 * gunity))
arena = InterfaceObject(screen, background)

game = GameEngine(screen, arena, maps['eights'])

game.add_player(imgsety, 1, -200, 0, [pg.K_w, pg.K_a, pg.K_s, pg.K_d])

winners = game.game_loop()

print(winners)
Esempio n. 2
0
menu = MainMenu(screen)
config = menu.menu_loop()

while config['player_number'] != 0:

    n = config['player_number']

    players = config['players']
    sprites = players['sprites']
    controls = players['controls']

    orientations = config['map']['orientations']
    positions = config['map']['positions']

    if n > 0:
        background = pg.transform.scale(
            pg.image.load('assets/img/background.jpg'),
            (60 * gunity, 30 * gunity))
        arena = InterfaceObject(screen, background)
        game = GameEngine(screen, arena, config['map'])

        for i in range(n):
            game.add_player(sprites[i], orientations[i], *positions[i],
                            controls[i])

        winners = game.game_loop()

        menu.ending_screen(winners)

        del game