Example #1
0
    def weapon_pick(self):
        clearConsole()
        print("")
        print(text_wrapper('|', '|', '-'))
        print(text_wrapper('| Wybierz Broń', '|', ' '))
        print(text_wrapper('| 1. Plainsrider Bow', '|', ' '))
        print(text_wrapper('| 2. USP Compact Tactical', '|', ' '))
        print(text_wrapper('| 3. Vulcan Minigun', '|', ' '))
        print(text_wrapper('| Wybieraj mądrze.', '|', ' '))
        print(text_wrapper('|', '|', '-'))
        print("")
        ch = readkeys.getch()
        if ch == "1":
            self.Weapon = Gun('Plainsrider Bow', 3)
            self.Part.add_threat(-20)
            self.class_pick()
        elif ch == "2":
            self.Weapon = Gun('USP Compact Tactical', 10)
            self.Part.add_threat(0)
            self.class_pick()

        elif ch == "3":
            self.Weapon = Gun('Vulcan Minigun', 20)
            self.Part.add_threat(25)
            self.class_pick()
Example #2
0
 def welcome(self):
     clearConsole()
     print(text_wrapper("|", "|", "-"))
     print(
         text_wrapper(
             "| Jesteś tajnym agentem, który musi wykraść niebezpieczną broń złej organizacji.",
             "|", " "))
     print(
         text_wrapper(
             "| Zadanie nie należy do najprostrzych, musisz wykazać się sprytem i dobrze zarządzać dostępnymi zasobami.",
             "|", " "))
     print(text_wrapper("| Każdy wybór ma znaczenie! ", "|", " "))
     print(text_wrapper("|", "|", "-"))
     print("")
     print(text_wrapper("|", "|", "-"))
     print(text_wrapper("| Wybieraj mądrze.", "|", " "))
     print(text_wrapper("|", "|", "-"))
     print("")
     print(text_wrapper("|", "|", "-"))
     print(text_wrapper("| Wciśnij spacje.", "|", " "))
     print(text_wrapper("|", "|", "-"))
     print("")
     ch = readkeys.getch()
     if ch == " ":
         self.weapon_pick()
Example #3
0
 def play_game(self):
     while True:
         try:
             user_input = readkeys.getch()
             if user_input == 'a' or user_input == 'A':
                 self.clear_console()
                 print('Wait for it')
                 self.sleep()
                 print('PRESS {} NOW'.format(self.keys_to_press))
                 start = time.time()
                 key = readkeys.getch()
                 end = time.time()
                 if key == 'a' or key == 'A':
                     if end - start < 0.01:
                         print(
                             '{} cheating bastard!. Do not press A before the message appears'
                             .format(self.player_1_name + ' is a'))
                     else:
                         print("{} did it in {} seconds".format(
                             self.player_1_name, end - start))
                 elif key == 'l' or key == 'L' and self.multiplayer_mode == True:
                     if end - start < 0.01:
                         print(
                             'Player 2 is a cheating bastard!. Do not press L before the message appears'
                         )
                     else:
                         print("Player 2 wins! You did it in {} seconds".
                               format(end - start))
                 else:
                     self.end_message = "You didn't press the correct key"
                 user_input = input(
                     "{} Enter A to continue. Enter any other key to exit game"
                     .format(self.end_message))
                 if user_input == 'a' or user_input == 'A':
                     self.reset_variables()
                     self.start_game()
                 else:
                     print('You entered another key. GG and Goodbye!')
                     quit()
         except Exception as e:
             print('Wrong button. Try again')
Example #4
0
    def start(self):
        clearConsole()
        print("")
        print("|------------|")
        print("| [1] Start  |")
        print("| [2] Zasady |")
        print("| [0] Wyjdź  |")
        print("|------------|")
        print("")

        ch = readkeys.getch()
        if ch == "1":
            self.welcome()
        elif ch == "2":
            self.rules()
        elif ch == "0":
            return
Example #5
0
    def action_pick(self, stage):
        clearConsole()
        print(text_wrapper("|", "|", "-"))
        print(
            text_wrapper("|    John Wick",
                         "Stage: " + str(stage) + "         |", " "))
        print(
            text_wrapper("|", "Ammo: " + str(self.Weapon.ammo) + "         |",
                         " "))
        print(
            text_wrapper("|", "Time: " + str(self.Part.time) + "         |",
                         " "))
        print(
            text_wrapper("|",
                         "Threat: " + str(self.Part.threat) + "         |",
                         " "))
        print(text_wrapper("|", "|", "-"))
        print(self.desc[stage - 1])
        i = 0
        tab = []
        for p in self.picks:
            if p[1] == stage:
                tab.append([])
                tab[i].append(p[2])
                tab[i].append(p[3])
                tab[i].append(p[4])
                tab[i].append(p[5])
                i += 1
                print(str(i) + ". " + p[0])

        ch = readkeys.getch()

        if stage == 10:
            self.gameover_win()
        else:
            for t in range(1, len(tab) + 1):
                if ch == str(t):
                    self.Part.add_time(tab[t - 1][1])
                    self.Part.add_threat(tab[t - 1][2])
                    if self.Part.time <= 0 or self.Part.threat >= 100:
                        self.gameover_lost(stage)
                    else:
                        self.action_pick(tab[t - 1][0])
Example #6
0
 def class_pick(self):
     clearConsole()
     print("")
     print(text_wrapper("|", "| ", "-"))
     print(text_wrapper("| Wybierz Klasę", "| ", " "))
     print(text_wrapper("| Wybieraj mądrze.", "| ", " "))
     print(text_wrapper("| 1. Ghost.", "| ", " "))
     print(text_wrapper("| 2. Anarchist.", "| ", " "))
     print(text_wrapper("| 3. Gambler.", "| ", " "))
     print(text_wrapper("|", "|", "-"))
     print("")
     ch = readkeys.getch()
     if ch == "1":
         self.Character = Player("John", "Wick", 0)
         self.action_pick(1)
     elif ch == "2":
         self.Character = Player("John", "Wick", 1)
         self.action_pick(1)
     elif ch == "3":
         self.Character = Player("John", "Wick", 2)
         self.action_pick(1)
Example #7
0
import sys, readkeys

c = None
while c != '$':
    c = readkeys.getkey(raw=False)
    sys.stdout.write(c + '#')
    sys.stdout.flush()

c = None
while c != '$':
    c = readkeys.getkey(raw=False)
    sys.stdout.write(c + '#')
    sys.stdout.flush()

c = None
while c != '$':
    c = readkeys.getkey(raw=False)
    sys.stdout.write(c + '#')
    sys.stdout.flush()

c = None
while c != '$':
    c = readkeys.getch(raw=False)
    sys.stdout.write(c + '#')
    sys.stdout.flush()