def __init__(self, player_score_instance, game_menu_instance): """Setting the keys on the keyboard to control the snakes and inits os, dict-obj, player score instance and menu instance. Note: _1 means something related to the 1-st snake, _2 means something related to the 2-nd snake. """ self.keys = set_keyboard_keys() self.UP_1 = [self.keys["UP_1"][0], self.keys["UP_1"][1]] # w W self.DOWN_1 = [self.keys["DOWN_1"][0], self.keys["DOWN_1"][1]] # s S self.LEFT_1 = [self.keys["LEFT_1"][0], self.keys["LEFT_1"][1]] # a A self.RIGHT_1 = [self.keys["RIGHT_1"][0], self.keys["RIGHT_1"][1]] # d D self.UP_2 = self.keys["UP_2"] # ^ self.DOWN_2 = self.keys["DOWN_2"] # v self.LEFT_2 = self.keys["LEFT_2"] # < self.RIGHT_2 = self.keys["RIGHT_2"] # > self.keys_player_2 = [ self.UP_2, self.DOWN_2, self.LEFT_2, self.RIGHT_2 ] self.RESET = set_cleaning_command() self.platform = init_os() self.settings_storage = {} # Dict for set_default_settings method. self.player_score = player_score_instance self.menu = game_menu_instance
def __init__(self): """Inits class BeforeTheGame with the player name, dictionary of future player's choice and self.gamemode. """ # The name of the player will be selected according to OS user name self.player_name = getpass.getuser() self._player_choice = {} self.gamemode = 1 self.platform = init_os() self.RESET = set_cleaning_command() self.validators = Validators()
def __init__(self, player_score_instance, game_menu_instance): """Setting the keys on the keyboard for windows to control the snake and inits os, dict-obj, player score instance and menu instance. """ self.keys = set_keyboard_keys() self.UP = [self.keys["UP_1"][0], self.keys["UP_1"][1]] # w W self.DOWN = [self.keys["DOWN_1"][0], self.keys["DOWN_1"][1]] # s S self.LEFT = [self.keys["LEFT_1"][0], self.keys["LEFT_1"][1]] # a A self.RIGHT = [self.keys["RIGHT_1"][0], self.keys["RIGHT_1"][1]] # d D self.RESET = set_cleaning_command() self.platform = init_os() self.settings_storage = {} self.player_score = player_score_instance self.menu = game_menu_instance
def open_git_repo_in_browser(): webbrowser.open("https://github.com/GonnaFlyMethod/snake1976") clean = set_cleaning_command() os.system(clean)
def __init__(self): self.platform = init_os() self.RESET = set_cleaning_command()