Esempio n. 1
0
    def __init__(self, player1: Player, player2: Player):
        """
        Constructs a new Game object. Creates an instance of the main menu window.
        :param: player1 (Player) - player 1 in the game
        :param: medium-level AI in the game
        :return: returns none.
        :pre: Both Players (Player 2 is AI in this case) have been initialized already with ships placed
        :post AI windows setup
        """

        print("Making game")

        self.player1 = player1
        self.player2 = player2
        self.turn_over = True
        self.game_over = False
        self.is_game_over = False
        self.count = 0
        self.own_board = arcade.Window(715, 715, "Your Board")
        self.other_board = arcade.Window(715, 715, "Their Board")
        self.player1_own_board = AI_window(WINDOW_WIDTH, WINDOW_HEIGHT,
                                           "Your Board", self.player1,
                                           self.on_turn_end, True)

        self.player1_other_board = BoardWindow(WINDOW_WIDTH, WINDOW_HEIGHT,
                                               "Their Board", self.player2,
                                               self.on_turn_end, False)

        self.own_board.show_view(self.player1_own_board)
        self.other_board.show_view(self.player1_other_board)

        self.current_player = self.player1
Esempio n. 2
0
def main():
    if os.name == "posix":
        window = arcade.Window(SCREEN_WIDTH,
                               SCREEN_HEIGHT,
                               "Instruction and Game Over Views Example",
                               fullscreen=True,
                               antialiasing=False)
    else:
        window = arcade.Window(SCREEN_WIDTH,
                               SCREEN_HEIGHT,
                               "Instruction and Game Over Views Example",
                               fullscreen=True)
    menu = MenuView()
    window.show_view(menu)
    arcade.run()
Esempio n. 3
0
def main():
    # Main method.
    window = arcade.Window(screen_w, screen_h, screen_t)
    start_view = Menu.MainView()
    start_view.setup()
    window.show_view(start_view)
    arcade.run()
Esempio n. 4
0
def main():
    """ Main method """
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    window.set_mouse_visible(False)
    start = StartView()
    window.show_view(start)
    arcade.run()
Esempio n. 5
0
def main():
    """ Start the game """
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    start_view = GameView()
    window.show_view(start_view)
    start_view.start_new_game()
    arcade.run()
Esempio n. 6
0
def main():
    window = arcade.Window(width=SCREEN_WIDTH,
                           height=SCREEN_HEIGHT,
                           title=SCREEN_TITLE)
    menu_view = IntroView(window)
    window.show_view(menu_view)
    arcade.run()
Esempio n. 7
0
def main():
    # Change working directory to this file's directory
    os.chdir(os.path.dirname(os.path.realpath(__file__)))
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    star_view = StartingView()
    window.show_view(star_view)
    arcade.run()
Esempio n. 8
0
def main():
    """ Main method """
    # window = MyGame(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    start_view = InstructionView()
    window.show_view(start_view)
    arcade.run()
Esempio n. 9
0
def main():
    global VIEW
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    VIEW = MyView()
    window.show_view(VIEW)
    VIEW.setup()
    arcade.run()
Esempio n. 10
0
def main():
    """ Main method """
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    start_view = InstructionView()
    window.show_view(start_view)
    # window.setup(window.level)
    arcade.run()
Esempio n. 11
0
def main():
    """ setup screen """
    
    window = arcade.Window(constants.SCREEN_WIDTH, constants.SCREEN_HEIGHT, constants.SCREEN_TITLE)
    start_view = FirstView()
    window.show_view(start_view)
    arcade.run()
Esempio n. 12
0
def main():
    """ Create the game window, setup, run
        #TO-DO load leaderboard file and send to game (?)
    """

    # Initialize
    global ALL_SCORES
    global GAME_SPEED_FLOOR

    ALL_SCORES = [   [0,"Brutus",   0],
                     [1,"TomWDavis",0]  ]
    GAME_SPEED_FLOOR = 5
    FULL_SCREEN = False

    # Setup Questions
    askScores = input("Import Scores? (n/null): ")
    if input("Full Screen?   (y/null): ") != 'n': FULL_SCREEN = True

    # Import Old Scoreboard
    if askScores != "n" or askScores != "N": ALL_SCORES = importScores()
    print(ALL_SCORES)


    # Game launch
    window = arcade.Window(width=SCREEN_WIDTH, height=SCREEN_HEIGHT, title=SCREEN_TITLE, fullscreen=FULL_SCREEN, resizable=True)
    window.set_mouse_visible(False)

    # Launch Game
    menu_view = MenuView()   #start game in MenuView()
    window.show_view(menu_view)

    arcade.run()
Esempio n. 13
0
def main():
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    start_view = InstructionView()
    window.show_view(start_view)
    # start_view.setup()

    arcade.run()
Esempio n. 14
0
def main():
    """ Main method """
    game_window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    main_menu = MainMenu()
    game_window.show_view(main_menu)
    #game_window.setup()
    arcade.run()
Esempio n. 15
0
def main():
    """ Main method """
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    game_view = GameView()
    window.show_view(game_view)
    game_view.setup()
    arcade.run()
Esempio n. 16
0
def main():

    window = arcade.Window(constants.SCREEN_WIDTH, constants.SCREEN_HEIGHT,
                           constants.SCREEN_TITLE)

    views = {}

    game = Director(views)
    game_state = GameState()
    start_screen = StartScreen(views)
    controls = ControlScreen(views)
    game_over = GameOverView(views)
    win_screen = WinScreen(views)

    views['window'] = window
    views['game'] = game
    views['start_screen'] = start_screen
    views['controls'] = controls
    views['game_over'] = game_over
    views['win_screen'] = win_screen
    views['game_state'] = game_state

    views['window'].show_view(views['start_screen'])
    game_view = views['start_screen']
    game_view.setup()
    arcade.run()
Esempio n. 17
0
def main():
    """ Main method """

    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE,  fullscreen=True)
    start_view = InstructionView()
    window.show_view(start_view)
    arcade.run()
Esempio n. 18
0
def main():
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT,
                           "Instruction and Game Over Views Example")
    menu = MenuView()
    window.show_view(menu)

    arcade.run()
Esempio n. 19
0
def run() -> None:
    """Loads a new game window
    """

    log_path = pathlib.Path("assets/data/logs/")

    if not log_path.exists():
        log_path.mkdir()

    log_list = list(log_path.rglob("*.log"))
    if len(log_list) > 10:
        pathlib.Path(log_list[0]).unlink()

    logging.basicConfig(filename="assets/data/logs/{}.log".format(
        str(datetime.now())[:-7].replace(":", ".")),
                        level=logging.INFO)
    logging.info("Game Started")

    window = arcade.Window(800, 600, "Flat Survival")
    menu_view = MenuView(window)
    window.show_view(menu_view)
    try:
        arcade.run()
    except OSError:
        pass
Esempio n. 20
0
def main():
    """ Main method """

    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    start_view = StartMenuView()
    window.show_view(start_view)
    arcade.run()
Esempio n. 21
0
    def __start__(self):
        random.seed()
        # load the sounds
        self.snds['music'] = arcade.Sound('resources/music.wav', True)
        self.snds['victory'] = arcade.Sound('resources/victory.wav')
        self.snds['select'] = arcade.Sound('resources/select.wav')
        self.snds['no-select'] = arcade.Sound('resources/no-select.wav')
        self.snds['confirm'] = arcade.Sound('resources/confirm.wav')
        self.snds['wall-hit'] = arcade.Sound('resources/wall_hit.wav')
        self.snds['paddle-hit'] = arcade.Sound('resources/paddle_hit.wav')
        self.snds['pause'] = arcade.Sound('resources/pause.wav')
        self.snds['score'] = arcade.Sound('resources/score.wav')
        self.snds['brick-hit-1'] = arcade.Sound('resources/brick-hit-1.wav')
        self.snds['brick-hit-2'] = arcade.Sound('resources/brick-hit-2.wav')
        self.snds['high_score'] = arcade.Sound('resources/high_score.wav')
        self.snds['recover'] = arcade.Sound('resources/recover.wav')
        self.window = arcade.Window(const.SCREEN_WIDTH,
                                    const.SCREEN_HEIGHT - 10,
                                    const.SCREEN_TITLE)
        arcade.set_viewport(0, const.SCREEN_WIDTH, 5, const.SCREEN_HEIGHT - 5)
        self.snds['music'].play(const.VOLUME)

        # load the textures
        self.textures['bricks'] = arcade.load_spritesheet(
            const.BRICK_TEXTURES, const.BRICK_WIDTH, const.BRICK_HEIGHT,
            const.BRICK_COL, const.BRICK_COUNT)
        self.textures['balls'] = arcade.load_textures(const.BALL_TEXTURES,
                                                      const.BALL_LOCATIOINS)
        self.textures['paddles'] = arcade.load_textures(
            const.PADDLE_TEXTURES, const.PADDLE_LOCATIONS)
        self.textures['arrows'] = arcade.load_textures(const.ARROW_TEXTURES,
                                                       const.ARROW_LOCATIONS)
        # create the game controller interface
        self.gc = game_controller(game_device.setup())
        self.sprites = arcade.SpriteList()
Esempio n. 22
0
 def test_set_size_location(self):
     import arcade
     window = arcade.Window(200, 100)
     window.set_size(900, 800)
     self.assertEqual(window.width, 900)
     self.assertEqual(window.height, 800)
     window.close()
Esempio n. 23
0
def main():
    """ Main method """
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    window.set_mouse_visible(False)
    menu = splashScreen()
    window.show_view(menu)
    arcade.run()
Esempio n. 24
0
def main():
    """ Main method """
    window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    level_3_view = Level3View()
    level_3_view.setup()
    window.show_view(level_3_view)
    arcade.run()
Esempio n. 25
0
def run_game():
    """Function which run game"""
    os.chdir(os.path.split(os.path.realpath(__file__))[0])
    window = arcade.Window(GAME_WIDTH, GAME_HEIGHT, "Flappy Bird")
    start_view = differents_views.StartView()
    window.show_view(start_view)
    arcade.run()
Esempio n. 26
0
def main():
    window = arcade.Window(C.SCREEN_WIDTH,
                           C.SCREEN_HEIGHT,
                           C.TITLE,
                           update_rate=1 / 120)
    window.show_view(MainMenu(window))
    arcade.run()
Esempio n. 27
0
def main():
    """ Main method """
    window = arcade.Window(constants.SCREEN_WIDTH, constants.SCREEN_HEIGHT,
                           constants.SCREEN_TITLE)
    menu_view = menu.MenuView()
    window.show_view(menu_view)
    arcade.run()
Esempio n. 28
0
def main(gm=False):
    if not gm:
        window = arcade.Window(SCREEN_WIDTH,
                               SCREEN_HEIGHT,
                               'Help',
                               resizable=True)
        window.show_view(GameOver(1, 0, 0))
        arcade.run()
def main():
    window = arcade.Window(SCREEN_WIDTH,
                           SCREEN_HEIGHT,
                           SCREEN_TITLE,
                           resizable=False)
    start_menu = StartMenuView()
    window.show_view(start_menu)
    arcade.run()
Esempio n. 30
0
def main() -> None:
    """ Main """
    window = arcade.Window(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE)
    print('Window created')
    menu_view = MenuView()
    window.show_view(menu_view)
    print('Game view on screen')
    arcade.run()