def setup(self, level):
        #setup sprite lists
        self.view_bottom = 0
        self.view_left = 0
        self.score = 0
        self.coinTotal = 0
        self.player_list = arcade.SpriteList()
        self.coin_list = arcade.SpriteList()
        self.wall_list = arcade.SpriteList()
        self.enemy_list = arcade.SpriteList()
        self.background_list = arcade.SpriteList()
        self.door_list = arcade.SpriteList()
        self.questionAsked = False

        #setup player sprite:
        self.player_sprite = Player()
        self.player_sprite.center_x = 128
        self.player_sprite.center_y = 128
        self.player_list.append(self.player_sprite)

        #setup level info:
        self.level = level  #Needed so the StartView can choose the level
        self.levels = Levels.level_list
        self.levels[self.level].setup()

        self.wall_list = self.levels[self.level].get_walls()

        self.coin_list = self.levels[self.level].get_coins()

        self.enemy_list = self.levels[self.level].get_enemies()

        self.background_list = self.levels[self.level].get_background()

        self.door_list = self.levels[self.level].get_doors()

        self.coinTotal = len(self.coin_list)

        #setup background:
        if level == 1:
            arcade.set_background_color((109, 205, 247))

        #setup Computer Clue system:
        self.questObj.createlist()
        self.questObj.createQuestions()

        self.comp_clue = ComputerClue.ComputerClue()
        self.comp_clue.setup(self.questObj.questions[level], self.level,
                             self.questObj.answers[level])

        # set pause menu
        self.pause_menu = PauseMenu.PauseMenu(self)

        ##setup physics engine:
        self.physics_engine = arcade.PhysicsEnginePlatformer(
            self.player_sprite, self.wall_list, GRAVITY)
Beispiel #2
0
    def __init__(self):
        Tk.__init__(self)

        GlobalGame.append(self)

        self.fps_clock = pg.time.Clock()
        self.ticks = 0
        self.paused = False
        self.title(Title + " - " + Version)
        self.iconbitmap(TexturePath + "icon.ico")

        self.d = KeyBind("d", self, self.loop)
        self.a = KeyBind("a", self, self.loop)
        self.mlc = KeyBind("B1-Motion",
                           self,
                           self.loop,
                           release="ButtonRelease-1")
        self.mrc = KeyBind("B3-Motion",
                           self,
                           self.loop,
                           release="ButtonRelease-3")
        self.lc = KeyBind("Button-1",
                          self,
                          self.loop,
                          release="ButtonRelease-1")
        self.rc = KeyBind("Button-3",
                          self,
                          self.loop,
                          release="ButtonRelease-3")
        self.shift = KeyBind("Shift_L", self, self.loop)
        self.motion = KeyBind("Motion",
                              self,
                              self.loop,
                              release="KeyRelease-j")
        self.space = KeyBind("space", self, self.loop)
        self.resizable(False, False)
        self.bind("<Escape>", self.pause)
        self.geometry("1300x800")

        self.level = World(self)
        self.pauseMenu = PauseMenu(self)

        while True:

            self.loop()
Beispiel #3
0
# Set up Pause
list_pause = [ Button("logo", "../imgs/title/logo-small.png", SCREEN_DISPLAY, [446,72]),
             Button("title", "../imgs/title/title-paused.png", SCREEN_DISPLAY, [528,162]),
             # Pause Buttons
             Button("resume", "../imgs/gui-pause/btn-resume.png", SCREEN_DISPLAY, [401,310]),
             Button("restart", "../imgs/gui-pause/btn-restart.png", SCREEN_DISPLAY, [401,392]),
             Button("menu", "../imgs/gui-pause/btn-menu.png", SCREEN_DISPLAY, [401,473]),
             Button("quit", "../imgs/gui-pause/btn-quit-long.png", SCREEN_DISPLAY, [401,555]),
             ]

# Create dictionaries of menu buttons
dict_main = create_btn_dict(list_main)
dict_mode = create_btn_dict(list_mode)
dict_lb = create_btn_dict(list_lb)
dict_tut = create_btn_dict(list_tut)
dict_credits = create_btn_dict(list_credits)
dict_pause = create_btn_dict(list_pause)
# dict_play = create_btn_dict(list_play)
   
# Create leaderboards for classic (0) and survival mode (1)
lb_modes = [Leaderboard(), Leaderboard()]

MODE_MENU = ModeMenu("../imgs/bkg/bkg-original-720.png", SCREEN_DISPLAY, dict_mode)
TUTORIAL = TutorialMenu("../imgs/bkg/bkg-original-720.png", SCREEN_DISPLAY, dict_tut)
LB_MENU = LBMenu("../imgs/bkg/bkg-original-720.png", SCREEN_DISPLAY, dict_lb, lb_modes)
CREDITS = CreditsMenu("../imgs/bkg/bkg-original-720.png", SCREEN_DISPLAY, dict_credits)
PAUSE_MENU = PauseMenu("../imgs/bkg/bkg-original-720.png", SCREEN_DISPLAY, dict_pause)

MAIN = MainMenu("../imgs/bkg/bkg-original-720.png", SCREEN_DISPLAY, dict_main, LB_MENU, TUTORIAL, CREDITS, MODE_MENU)