Beispiel #1
0
def main(title='', user=None):
    import logging
    logging.basicConfig(level=logging.DEBUG)

    import sys
    game.main(*sys.argv[1:])
    return 0
Beispiel #2
0
def talker(user):
    menu_items = {
        '1': enter_game,
        '2': change_my_password,
        '0': exit_mud,
        '4': test_game,
        'a': show_user,
        'b': edit_user,
        'c': del_user,
    }
    logger.debug("QNMRQ: %d", user.qnmrq)
    if user.qnmrq:
        main("   --}----- ABERMUD -----{--    Playing as ", user)
    cls()
    while True:
        print("Welcome To AberMUD II [Unix]\n\n")
        print("Options\n")
        print("1]  Enter The Game")
        print("2]  Change Password")
        print("\n\n")
        print("0] Exit AberMUD")
        print("\n")
        if user.isawiz:
            print("4] Run TEST game")
            print("A] Show persona")
            print("B] Edit persona")
            print("C] Delete persona")
        print("\n\n")
        answer = input("Select > ").lower()
        action = menu_items.get(answer)
        if action is None:
            print("Bad Option")
        else:
            action(user)
def random_GUI_game():
    try:
        main(testgame=1)
    except Exception as e:
        print(e)
        return False
    return True
Beispiel #4
0
def localMenuInput():
    choice = input('')
    acceptableInput = ['1', '2', '3', '4', 'q']

    while (True):
        if choice in acceptableInput:
            if (choice == 'q'):
                quit()
            if (int(choice) == 4):
                game.main()
            elif (int(choice) == 2):
                print('\033c', end='')
                prints.printDifficultySettings()
                difficultySettings('Player', 'UU-BOT')
            elif (int(choice) == 1):
                player1, player2 = namePlayers()
                game.playVersusHuman(player1, player2)
            elif (int(choice) == 3):
                #play tournament
                #game.playLocalTournament()
                prints.printHowManyPlayers()
                humans = tournamentHowManyPlayers()
                playerList, humanDict = tournamentNamePlayers(humans)
                prints.printHowManyAI()
                ais = tournamentHowManyAI()
                playerList, humanDict = tournamentAddAI(playerList, humanDict, ais)
                game.playLocalTournament(playerList, humanDict)
                game.main()
        else:
            choice = input('Please enter a number between 1-4\n')
        
        
    return
Beispiel #5
0
def main():

    #Setup
    funcs.initGame(WIN_WIDTH, WIN_HEIGHT, game_vars.caption)

    #Main Loop
    while game_vars.runGame:
        if game_vars.gameScreen == "game":
            if game_vars.firstCall:
                funcs.startGame()
                level.levelSpawner.draw()
                game_vars.firstCall = False
            game_vars.time += game_vars.clock.get_time()
            game.main()
        if game_vars.gameScreen == "intro":
            intro.main()
        if game_vars.gameScreen == "paused":
            pause.main()
        elif game_vars.gameScreen == "finish":
            finish.main()

        try:
            funcs.updateMusic()
        except: pass

        game_vars.clock.tick(game_vars.fpsLimit)
    pygame.quit()
    sys.exit()
Beispiel #6
0
 def move_easy(self, character):
     global spider_count
     global skeleton_count
     global orc_count
     global troll_count
     # Move right X3
     self.move_east(character)
     self.move_east(character)
     self.move_east(character)
     # Move down
     self.move_south(character)
     # Move left X3
     self.move_west(character)
     self.move_west(character)
     self.move_west(character)
     # Move down
     self.move_south(character)
     # Move right X3
     self.move_east(character)
     self.move_east(character)
     self.move_east(character)
     # Move down X1
     self.move_south(character)
     # Move left X3
     self.move_west(character)
     self.move_west(character)
     self.move_west(character)
     print(character.name, "has completed the dungeon")
     print(character.name, "fought", spider_count, "Giant Spiders")
     print(character.name, "fought", skeleton_count, "Skeletons")
     print(character.name, "fought", orc_count, "Orcs")
     print(character.name, "fought", troll_count, "Trolls")
     print(character.name, "collected treasures worth", character.treasures)
     time.sleep(5)
     game.main()
Beispiel #7
0
def test_full_game(capsys):
	"""Vezmi input() a vloz do nej fci "input_fake_rock()"."""
		
	game.main(input=input_fake_rock) # implementuji fixture
	catch = capsys.readouterr() # precti stdin a stdout
	
	# kontroluj obsah stdout s input() textem
	assert 'Choice: rock, scissors, paper: ' in catch.out
Beispiel #8
0
def main():
    spyral.director.init((0,0), fullscreen = False, max_fps = 30)
    import game
    game.main()
    try:
        spyral.director.run()
    except KeyboardInterrupt:
        spyral.director.quit()
Beispiel #9
0
def enter_game(user, session=None):
    cls()
    print("The Hallway")
    print("You stand in a long dark hallway, which echoes to the tread of your")
    print("booted feet. You stride on down the hall, choose your masque and enter the")
    print("worlds beyond the known......\n")

    main("   --{----- ABERMUD -----}--    Playing as ", user)
Beispiel #10
0
def main():
    spyral.director.init((0,0), fullscreen = False, max_fps = 30)
    import game
    game.main()
    try:
        spyral.director.run()
    except KeyboardInterrupt:
        spyral.director.quit()
Beispiel #11
0
	def launch_mypinballs(self):
		self.stop_proc()

		# Import and run the startup script, further execution of this script is halted until the run_loop is stopped.
		import game
		game.main()

		# Reset mode & restart P-ROC / pyprocgame
		self.mode_started()
		self.restart_proc()
Beispiel #12
0
def start():
    global game_next
    game_next = 0
    app = QApplication(sys.argv)
    ex = Example()
    ex.show()
    app.exec()
    if game_next == 1:
        game.main(level)
    sys.exit()
def handle_text_message(event):
    incoming_msg = (event.message.text).lower()

    print('Income message: ' + incoming_msg)
    if incoming_msg == 'bales dong':
        line_bot_api.reply_message(event.reply_token,
                                   TextSendMessage('knp ey?'))

    # Call main game function
    game.main(event, line_bot_api, handler, incoming_msg)
Beispiel #14
0
def main():

    #initialize and setup screen
    pygame.init()
    clock = pygame.time.Clock()

    #Fullscreen if capable, will default to 1024, 640 if fullscreen fails.
    screen = pygame.display.set_mode((1024, 640), pygame.FULLSCREEN, 32)

    #load image and quadruple
    background_path = os.path.join(image_dir, 'menu.bmp')
    bitmap = pygame.image.load(background_path)
    anim = 0.0

    #Load and play intro sound byte
    intro_sound = os.path.join(sound_dir, 'intro.wav')
    pygame.mixer.music.load(intro_sound)
    pygame.mixer.music.play(0, 0.0)
    pygame.mouse.set_visible(False)

    #Initialize sprites.
    startDisplay = StartDisplay()
    exitDisplay = ExitDisplay()
    cursor = Cursor()

    #Create sprite group.
    sprites = pygame.sprite.RenderPlain(startDisplay, exitDisplay, cursor)

    #mainloop
    xblocks = range(0, 1024, 20)
    yblocks = range(0, 640, 20)

    Run = True
    while Run:

        #This loop give the background the liquid appearance.
        anim = anim + 0.2
        for x in xblocks:
            xpos = (x + (sin(anim + x * .01) * 15)) + 20 #Sin functions are used to manipulate the pixels.
            for y in yblocks:
                ypos = (y + (sin(anim + y * .01) * 15)) + 20
                screen.blit(bitmap, (x, y), (xpos, ypos, 20, 20)) #Update the screen after the pixels have been changed.

        #Event loop that determine if an event has happened.
        for event in pygame.event.get():
            if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
                sys.exit() #Run = False #Quit with ESC key
            if event.type == MOUSEBUTTONDOWN:
                if pygame.sprite.collide_rect(cursor, startDisplay):
                    game.main() #Start game if clicked.
                if pygame.sprite.collide_rect(cursor, exitDisplay):
                    sys.exit() #Run = False #Exit game if clicked.

        sprites.update(screen) #Calls the update functions for all sprites in the sprite group.
        pygame.display.flip() #Update the contents of the entire display.
Beispiel #15
0
    def comenzar_nuevo_juego(self):
        systemLang = os.environ["LANG"][:2]
        if systemLang == "es":
            print "Cambiando el lenguaje a esp"
            lang = "esp"
        else:
            print "Cambiando el lenguaje a bra"
            lang = "bra"

        import game
        game.main(lang)
Beispiel #16
0
def start(event):
    global root1, txt, name, color
    name = txt.get()
    root1.destroy()
    game.main(n, color)
    button = tk.Button(text='Вернуться в меню',
                       width=15,
                       height=2,
                       font='arial 14')
    button.place(x=820, y=10)
    button.bind('<Button-1>', clickedmenu)
    game.new_game()
Beispiel #17
0
def main(WIN):
    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:  # If hit red cross on pygame window
                break

            if event.type == pygame.MOUSEBUTTONDOWN:  # If any button on mouse pressed down
                game.main(WIN)

        draw_how_to_play_screen(WIN)

    sys.exit()
Beispiel #18
0
    def select(self):
        if (engine.currentSelection == 0):
            pygame.mixer.music.stop()
            game.main()
            quit(self)

        elif (engine.currentSelection == 1):
            #play credits
            pass

        elif (engine.currentSelection == 2):
            quit(self)
    def test_play_game(self, mock_print, mock_guesses, mock_secret):

        game.main()

        # Create a list of expected call objects. These will be compared to the actual calls made
        # to the mock_print method.
        expected_calls = [
            call('too low!'),
            call('too high!'),
            call('Correct!')
        ]
        self.assertEqual(expected_calls, mock_print.call_args_list)
Beispiel #20
0
def draw(mode):
    if mode == "menu":
        draw_menu()

    elif mode == "game":
        import game
        game.main()
        change_mode('menu')
    elif mode == "levels":
        import levels
        levels.main()
        change_mode('menu')
Beispiel #21
0
def inter_smashgrate(item_id,object_id):
    from player import inventory
    from player import current_room
    from map import rooms
    global current_room
    if item_id == "rock":
        inventory.remove(item_rock)
        print("""You smash the grating with the rock,
a small hole is opened. You can see light outside...""")
        input("Press ENTER to continue...")
        print("""You crawl through the small space and your eyes
struggle to adjust to the bright sunlight.""")
        current_room = rooms["Courtyard"]
        from game import main
        main()
Beispiel #22
0
def test_main():
    """This function tests the main function"""
    def new_play(self):
        """We need this function to test the main function"""
        self.boolean = False

    with patch.object(Game, 'play', new_play):
        result = main()
    assert result
Beispiel #23
0
def launchGame(i):
    name = i
    score = bestPlayer.score if bestPlayer != None else 0
    p = game.main([
                'mode=training', 
                'filename=score\\' + str(name)+'.json',
                'speed=20', 
                'score=' + (str(score) if score > 2000 else '2000') 
            ])
    print(str(name) +  ' : '  + str(p.score))
Beispiel #24
0
def introduction(
):  #Print the introduction to the game and then start the game
    intro_list = [
        "You come to life with a splutter, air pouring into your lungs.",
        "You manage to gain control of your breathing.",
        "You don't remember anything, where are you?", "What happened?",
        "You look around and see you are in a hospital bed.",
        "All of the machines and lights are off, something seems off.",
        "Surely someone would have at least rushed past the door...",
        "Where is everyone?",
        "You struggle to sit up, but you need to look around.",
        "You stumble onto your feet, you need to find out what has happened."
    ]
    for items in intro_list:
        type_print(items)
        time.sleep(
            1
        )  #Have a 1 second break between lines so the user can read it and to add dramatic effect
    main()
Beispiel #25
0
    def __init__(self, screen):
        self.screen = screen
        self.menu = EzMenu(
                ["New Game", lambda: game.main(self.screen)], 
                ["Quit Game", lambda: credits.main(self.screen)],
                ["Settings", lambda: game.main(self.screen)],
                )
        self.menu.set_highlight_color((255, 255, 255))
        self.menu.set_normal_color((10, 10, 10))
        self.menu.center_at(550, 470)
        self.menu.set_font(pygame.font.Font(filepath("pointy.ttf"), 36))

        
        #start music playing forever
        pygame.mixer.init()
        pygame.mixer.music.set_volume(0.8)
        pygame.mixer.music.load(data.filepath('felix8.xm'))
        pygame.mixer.music.play(-1)

        self.main_loop()
Beispiel #26
0
def main():
    # holder variables for optional data to include between menus
    opt = [False]
    while True:
        # response holds the answer to what button the user clicked
        response, opt = menu.main(opt)

        # quit button
        if response == "quit":
            # ends application
            sys.exit()

        # start button
        elif response == "start":
            # launches game
            game.main()

        # rules button
        elif response == "rules":
            # show rules page
            opt = menu.mainRules(opt)
Beispiel #27
0
def onClick():
    label.forget()
    value = game.main(root)
    if value:
        f = open("save", 'r')
        score, coin = map(int, f.readline().split())
        score, coin = max(score, value[0]), max(coin, value[1])
        f = open("save", 'w')
        f.write("%d %d" %(score, coin))
        f.close()
        label.pack()
        displayRecord(score)
Beispiel #28
0
def onlineMenuInput():
    choice = input('')
    acceptableInput = ['1', '2', '3']

    while (True):
        if choice == 'q':
            quit()
        if choice in acceptableInput:
            if (int(choice) == 3):
                game.main()
            elif (int(choice) == 2):
                print('\033c', end='')
                main.online_tour_play()

            elif (int(choice) == 1):
                print('\033c', end='')
                prints.printOnlineHostingMenu()
                onlineMenuHostOrClientInput()
        else:
            choice = input('Please enter a number between 1-3\n')
        return
Beispiel #29
0
def menu():
    """
    Main method of the game
    """
    print(gameMenu)
    while True:
        action = input()
        actionlist = action.split(" ")
        if action == "s" or action.lower() == 'start':
            print("Starting the game from beginning")
            print("\x1b[2J\x1b[H")
            print(story)
            print("")
            input("Press Enter to start the game")
            game.main()
        elif action == "q" or action.lower() == 'quit':
            action2 = input("Are you sure you want to quit? (y/n): ")
            if action2.lower() == "y":
                return
            elif action2.lower() == "n":
                pass
        elif "load" in action.lower():
            #loaded = True
            if len(actionlist) == 2:
                fname = actionlist[1]
                print("Loading the game from file {}".format(fname))
                game.loadFunction(fname)
                game.main()
            elif len(actionlist) > 2:
                fname = actionlist[1] + " " + actionlist[2]
                print("Loading the game from file {}".format(fname))
                game.loadFunction(fname)
                game.main()
            elif len(actionlist) < 2:
                print("You have to provide a filename.")
Beispiel #30
0
    def action(self):
        if self.start and not self.world.dialog.visable:
            oldDir = os.getcwd()
            gameDir = "../mini game/Zelda-love-Candy-0.3"
            os.chdir(gameDir)
            sys.path.insert(0, os.getcwd())
            sys.path.insert(1, "../mini game/Zelda-love-Candy-0.3/lib")
            sys.path.insert(2, "../mini game/Zelda-love-Candy-0.3/data")
            import game
            try:
                game.main()
            except:
                pass
            os.chdir(oldDir)

            self.world.dialog.setMessage(["I told you that it is still nnot now working! Thank you!"])
            self.kill()
            self.start = False

        if self.world and not self.world.dialog.visable:
            self.world.dialog.setMessage(["This mini game is not working properly now.",
                                         "You can go to the mini game folder and run the game by itself"])
        self.start = True
Beispiel #31
0
def login():
    username = str(input("Enter name:")).lower()
    password = str(input("Enter password:"******"Logged in!")
            game.main(lineUser)
        else:
            print("It Does not Match :(")
    else:
        print("User not found")
        registerNewUser = bool(input("Do you wanna join? y/n?") == 'y')
        if registerNewUser:
            signup.signup(username, password)
            game.main(username)
        else:
            exit()
Beispiel #32
0
def askLoad():
    load = input(
        co.b +
        'Would you like to make a new game or load an old save?\nNew - 1\nOld - 2\n >>> '
    ).strip().lower()
    if load == '1':
        cl.Dragon = cl.Base
        c()
        askColor()
        askName()
        saves.save_game()
        saves.save_scores()
        game.welcome()
        game.main()
    elif load == '2':
        loads.load_game()
        loads.load_scores()
        c()
        game.main()
    else:
        print(co.y + "Please respond with a 1 or a 2.")
        s(1.5)
        c()
        askLoad()
Beispiel #33
0
def display_screen(screen, boards, click, x, y):
    global HIGHLIGHT_COL, HIGHLIGHT_ROW
    # print(len(boards))
    selected = False
    screen.fill((255, 255, 255))
    if HIGHLIGHT_ROW * NUM_COLS + HIGHLIGHT_COL < len(boards):
        pygame.draw.rect(screen, (255, 255, 0),
                         (GAP // 2 + HIGHLIGHT_COL *
                          (WIDTH + GAP), GAP // 2 + HIGHLIGHT_ROW *
                          (WIDTH + GAP), WIDTH + GAP, WIDTH + GAP))
    for i in range(len(boards)):
        draw_board(screen, boards[i], i)
    if back_image_1.x <= x <= back_image_1.x + back_image_1.width and back_image_1.y <= y <= back_image_1.y + back_image_1.height:
        screen.blit(back_image_2.image, (back_image_2.x, back_image_2.y))
        if click:
            return 1
    else:
        screen.blit(back_image_1.image, (back_image_1.x, back_image_1.y))
    if tick_image_1.x <= x <= tick_image_1.x + tick_image_1.width and tick_image_1.y <= y <= tick_image_1.y + tick_image_1.height:
        screen.blit(tick_image_2.image, (tick_image_2.x, tick_image_2.y))
        if click and HIGHLIGHT_ROW * NUM_COLS + HIGHLIGHT_COL < len(boards):
            return game.main(screen,
                             boards[HIGHLIGHT_ROW * NUM_COLS + HIGHLIGHT_COL])
    else:
        screen.blit(tick_image_1.image, (tick_image_1.x, tick_image_1.y))
    if thrash_image_1.x <= x <= thrash_image_1.x + thrash_image_1.width and thrash_image_1.y <= y <= thrash_image_1.y + thrash_image_1.height:
        screen.blit(thrash_image_2.image, (thrash_image_2.x, thrash_image_2.y))
        if click:
            to_pop = HIGHLIGHT_ROW * NUM_COLS + HIGHLIGHT_COL
            if to_pop < len(boards): boards.pop(to_pop)
            board_manager.save()
            time.sleep(0.1)
            click = False

    else:
        screen.blit(thrash_image_1.image, (thrash_image_1.x, thrash_image_1.y))
    if click:
        ROW = y // (SCREEN_WIDTH // NUM_COLS)
        COL = x // (SCREEN_WIDTH // NUM_COLS)
        if NUM_COLS * ROW + COL < len(boards):
            HIGHLIGHT_ROW = ROW
            HIGHLIGHT_COL = COL
    pygame.display.update()
Beispiel #34
0
def run_game():
    import game
    print("Running generated game...")
    game.main()
Beispiel #35
0
    def GoToGame(self, event):
        self.Destroy()

        #Calls the main method of game.py
        game.main()
Beispiel #36
0
#! /usr/bin/env python

import sys
import os
try:
    libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))
    sys.path.insert(0, libdir)
except:
    # probably running inside py2exe which doesn't set __file__
    pass


import game

if __name__ == '__main__':
    game.main()

Beispiel #37
0
def main():
    #SCREEN_SIZE = ( 640, 480 )
    SCREEN_SIZE  = ( 800, 600 )
    #SCREEN_SIZE  = ( 1024, 768 )

    pygame.init()
    screen = pygame.display.set_mode( SCREEN_SIZE )
    pygame.display.set_caption('...::HeRobot::...')
    background, a = load_image( choice( backgrounds ) ) 
    icon, a = load_image( icon_filename )
    pygame.display.set_icon(icon)
    
    font             = pygame.font.Font( filepath(font_filename), 32)
    fontColor        = ( 255, 200, 0 )
    backgroundColor  = None #( 0, 0, 0)
    menuPosition     = ( 460, 80 ) # 800x600

    Fullscreen       = False
    menuItemSelected = 0
    showMenu         = True

    presentation(phrase, pygame.font.Font( filepath(font_filename), 100), screen)
    key  = { "fullscreen":K_f, "quit":K_q, "left":K_LEFT, "right":K_RIGHT, "up":K_UP, "down":K_DOWN, "fire":K_SPACE, "select":K_RETURN }
    menu = [ 
            { "title": "New Game!", "action":"pay_game"  }, \
          #  { "title": "Show Score", "action":"show_intro" }, \
            { "title": "Show Intro", "action":"show_score" }, \
          #  { "title": "Credits", "action":"credits"  }, \
            { "title": "Quit", "action":"quit and bye bye!" } \
           ]



    while True:

        event = pygame.event.wait()

        if event.type == QUIT or ( event.type == KEYDOWN and ( event.key == K_ESCAPE or event.key == key['quit'] ) ) :
            exit()

        if event.type == KEYDOWN:

            
            if event.key == key['up']:
                if menuItemSelected > 0 :
                    menuItemSelected -= 1

            elif event.key == key['down']:
                if menuItemSelected < len(menu) - 1 :
                    menuItemSelected += 1

            elif event.key in [ key['fire'], key['select'] ] :
                # ejecuta la accion

                # print "Action: %i" % menuItemSelected
                # print menu[menuItemSelected]['action']

                if   menuItemSelected == 0 : #new game!
                    from game import main
                    main()

             #   elif menuItemSelected == 1 : #show score

                elif menuItemSelected == 1 : #show intro 2
                    presentation(phrase, pygame.font.Font( filepath(font_filename), 100), screen)

             #   elif menuItemSelected == 3 : #show credits
             #       from score import showHighScores
             #       showHighScores()

                elif menuItemSelected == 2 : #quit $
                    exit()

            #elif event.mouse

        if showMenu :

            screen.blit(background, (0, 0))
            x, y     = menuPosition
            menuItem = 0

            for item in menu:

                # calcular el area donde esta ubicado el texto en la pantalla
                # y asignarlo al item del menu, para luego poder calcular la 
                # posicion del mouse y saber si esta presionando sobre un item.
                # menu[menuItem]['area'] = 0

                y += icon.get_height()
                if menuItem != menuItemSelected :
                    text = font.render( item['title'], True, fontColor )
                    screen.blit( text, ( x + icon.get_width() + 10, y + ( icon.get_height() - text.get_height() ) / 2 ))
                else :
                    font.set_bold(True)
                    text = font.render( item['title'], True, fontColor )
                    font.set_bold(False)
                    screen.blit( icon, ( x, y ))
                    screen.blit( text, ( x + icon.get_width() + 10, y + ( icon.get_height() - text.get_height() ) / 2 ))

                y += 10
                menuItem += 1

            pygame.display.update()
Beispiel #38
0
        if showMenu :

            screen.blit(background, (0, 0))
            x, y     = menuPosition
            menuItem = 0

            for item in menu:

                # calcular el area donde esta ubicado el texto en la pantalla
                # y asignarlo al item del menu, para luego poder calcular la 
                # posicion del mouse y saber si esta presionando sobre un item.
                # menu[menuItem]['area'] = 0

                y += icon.get_height()
                if menuItem != menuItemSelected :
                    text = font.render( item['title'], True, fontColor )
                    screen.blit( text, ( x + icon.get_width() + 10, y + ( icon.get_height() - text.get_height() ) / 2 ))
                else :
                    font.set_bold(True)
                    text = font.render( item['title'], True, fontColor )
                    font.set_bold(False)
                    screen.blit( icon, ( x, y ))
                    screen.blit( text, ( x + icon.get_width() + 10, y + ( icon.get_height() - text.get_height() ) / 2 ))

                y += 10
                menuItem += 1

            pygame.display.update()

main()
Beispiel #39
0
 def run():
     import game
     spyral.director.init((1200,900), fullscreen = False, max_fps = 30)
     game.main()
     spyral.director.run(sugar = True)
Beispiel #40
0
def run():
	pygame.init()
	
	clock = pygame.time.Clock()

	screensize = (480, 480)

	bg = pygame.image.load("imagens\menu.jpg")
	
	pygame.mixer.music.load('sons\Kombat.wav')
	
	startMusic = pygame.mixer.Sound('sons\horadoshow.wav')
	
	screen = pygame.display.set_mode(screensize)

	myfont = pygame.font.Font('fontetitulo.ttf',40) 
	
	titulo = myfont.render("Pong Mutante", 1, (255,255,255))
	normal = myfont.render("Normal", 1, (0,255,0))
	monstro = myfont.render("Monstro", 1, (0,255,0))
	quit = myfont.render("Exit", 1, (255,0,0))

	menu = True
	pygame.mixer.music.play(-1)
	while menu:
		
		clock.tick(60)
		for event in pygame.event.get():
			if event.type == QUIT:
				menu = False 		

		screen.fill((100,100,100))
		screen.blit(bg, (0,0))
		mouse = pygame.mouse.get_pos()
		click = pygame.mouse.get_pressed()
		
		#Apertar botao Normal
		if 130+220 > mouse[0] > 130 and 185+50 > mouse[1] > 185:
			pygame.draw.rect(screen, (0,200, 0), (130, 185, 220, 50), 10)
			if click[0] == 1:
				startMusic.play()
				game.main(2)			
		else:
			pygame.draw.rect(screen, (0,200, 0), (130, 185, 220, 50), 1)
		#Apertar o botao monstro
		if 130+220 > mouse[0] > 130 and 245+50 > mouse[1] > 245:
			pygame.draw.rect(screen, (0,200, 0), (130, 245, 220, 50), 10)
			if click[0] == 1:
				startMusic.play()
				game.main(1)			
		else:
			pygame.draw.rect(screen, (0,200, 0), (130, 245, 220, 50), 1)		
		
		#Apertar Botao Sair
		if 130+180 > mouse[0] > 130 and 315+50 > mouse[1] > 315:
			pygame.draw.rect(screen, (200, 0, 0), (130, 315, 220, 50), 10)
			if click[0] == 1:
				menu = False
		else:
			pygame.draw.rect(screen, (200, 0, 0), (130, 315, 220, 50), 1)
			
		screen.blit(titulo, (75, 70))
		screen.blit(normal, (150, 185))
		screen.blit(monstro,(132,245))
		screen.blit(quit, (190, 315))
		
		pygame.display.update()
		
	pygame.quit()
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# DATA AREA: (IMPORTANT: DO NOT MODIFY THIS SECTION!)
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

import os
import sys

rootdir = os.path.join(os.path.abspath(os.path.dirname(os.path.realpath(__file__))), "rabbit")
if rootdir not in sys.path:
	sys.path.append(rootdir)

from game import main, hackergen, ircbot

#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# CODE AREA: (IMPORTANT: DO NOT MODIFY THIS SECTION!)
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if hackergen:
	whites.append(hackergen_whites)
	blacks.append(hackergen_blacks)

if len(sys.argv) < 4:
	print "USAGE: ip, port, channel"
	exit(1)
ip, port, channel = sys.argv[1], int(sys.argv[2]), sys.argv[3]

game = main(whites=whites, blacks=blacks, cards=cards, port=port, debug=debug)
bot  = ircbot(ip, port, channel, game.handlemessage)

bot.run()
Beispiel #42
0
def run_game():
    window.close()
    import game
    game.main()
Beispiel #43
0
def play_the_game():
    game.main()
Beispiel #44
0
	#########LEADERBOARD#########
	leaderboardText = startFont.render("Press 'L' to View High Scores", True, (0, 255, 0))
	leaderboardText_rect = leaderboardText.get_rect()

	#########INSTRUCTIONS#########
	instructionsText = startFont.render("Press 'I' to View Instructions", True, (0, 255, 0))
	instructionsText_rect = instructionsText.get_rect()

	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			pygame.quit()
			sys.exit(0)
		elif event.type == pygame.KEYDOWN:
			if event.key == pygame.K_RETURN:
				main(False, pygame.time.get_ticks())
			if event.key == pygame.K_c:
				main(True, pygame.time.get_ticks())
			if event.key == pygame.K_l:
				scores()
			if event.key == pygame.K_i:
				instructions()

	screen.fill(white)
	screen.blit(team, [width/2-(team_rect.w/2),height/8 - 40])
	screen.blit(title, [width/2-(title_rect.w/2),height/4 - 50])
	screen.blit(subTitle, [width/2-(sub_title_rect.w/2),height/4 + 15])
	screen.blit(start, [width/2-(start_rect.w/2),height/2 - 20])
	screen.blit(hard, [width/2-(hard_rect.w/2),height/2+40])
	screen.blit(leaderboardText, [width/2-(leaderboardText_rect.w/2),height/2+130])
	screen.blit(instructionsText, [width/2-(instructionsText_rect.w/2),height/2+190])
Beispiel #45
0
	def select(self):
		if self.rect.y == 30:
			game.main()
		if self.rect.y == 100:
			pygame.display.quit()
			sys.exit()                        
Beispiel #46
0
def enterGame(menu):
	del menu
	game.main()
Beispiel #47
0
def play3():
	global current_menu
	current_menu.turnOffButtons()
	game.main(3)
Beispiel #48
0
def askToPlayAgain():
    choice = input('       Play again? [yes/no]\n')
    if (choice == 'yes'):
        game.main()
    else:
        quit()
def button1(event):
    global canvas, root_copy
    canvas.delete(tk.ALL)
    game.main(root_copy)
Beispiel #50
0
 def launch():
     import game
     game.main()
Beispiel #51
0
def go_game(x):
        Window.close()
        import game
        game.main()
cards = 10

# Whether to turn on or off debug output:
debug = False

# What port to connect to:
port = 6775

#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# DATA AREA: (IMPORTANT: DO NOT MODIFY THIS SECTION!)
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

import os
import sys

rootdir = os.path.join(os.path.abspath(os.path.dirname(os.path.realpath(__file__))), "rabbit")
if rootdir not in sys.path:
    sys.path.append(rootdir)

from game import main, hackergen

#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# CODE AREA: (IMPORTANT: DO NOT MODIFY THIS SECTION!)
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if hackergen:
    whites.append(hackergen_whites)
    blacks.append(hackergen_blacks)

main(whites=whites, blacks=blacks, cards=cards, port=port, debug=debug).start()
Beispiel #53
0
    import panda3d
    import pyfastnoisesimd as fns
    import PIL
    import numpy as np
except ImportError as ex:
    print('''
===================================================
This game requires: 
    * Panda3D >= 1.10.4.1
    * Pillow/PIL >= 6.1.0
    * pyfastnoisesimd >= 0.4.1
    * numpy >= 1.17.2
    
Please run the following command to install it:
    pip install -r requirements.txt
===================================================
''')
    print(repr(ex))
    sys.exit(1)


print('Using Panda3D {0}'.format(panda3d.__version__))
print('Using Pillow {0}'.format(PIL.__version__))
print('Using pyfastnoisesimd {0}'.format(fns.__version__))
print('Using numpy {0}'.format(np.__version__))


if __name__ == '__main__':
    import game
    game.main()
#!/usr/bin/env python3

import sys

if sys.version_info[0] != 3 or sys.version_info[1] < 7:
    sys.exit("This game requires python 3.7")
print("Python version:", sys.version)

from game import main

main()
Beispiel #55
0
import game, sys

game.main(sys.argv)
Beispiel #56
0
if __name__ == '__main__':
    import pygame
    import sys
    import datetime
    logat = str(datetime.datetime.now().time()) + '@' + 'APP: '
    print(logat + ': ' + 'Loading Rects Fight V1.5')
    sys.path.insert(0, './data')
    import game as g
    print('Starting')
    pygame.init()
    g.title()
    g.char_select()
    g.main()
    pygame.quit()
Beispiel #57
0
def main():
	while True:
		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				sys.exit()
		screen = pygame.display.set_mode((640, 640))
		board = pygame.image.load('chessboard.gif').convert()
		board = pygame.transform.scale(board, (640, 640))
		clearBoard = pygame.image.load('chessboard.gif').convert()
		clearBoard = pygame.transform.scale(board, (640, 640))
		fontObject = pygame.font.Font(None, 30)
		title = fontObject.render("Welcome to A Chess Tutorial by Vishnu Rajendran", True, (0, 255, 0))
		quitButton = fontObject.render("QUIT", True, (255, 0, 0))
		playComputer = fontObject.render("Play Computer", True, (255, 0, 0))
		twoPlayer = fontObject.render("Two Player", True, (255, 0, 0))
		twoPlayerRect = pygame.Rect([240, 240, 160, 80])
		playComputerRect = pygame.Rect([240, 320, 160, 80])
		quitRect = pygame.Rect([240, 400, 160, 80])
		pygame.draw.ellipse(board, (0, 0, 255), twoPlayerRect)
		pygame.draw.ellipse(board, (0, 0, 255), quitRect)
		pygame.draw.ellipse(board, (0, 0, 255), playComputerRect)
		screen.blit(board, (0, 0))
		screen.blit(twoPlayer, (265, 265))
		screen.blit(playComputer, (250, 345))
		screen.blit(quitButton, (295, 425))
		screen.blit(title, (80, 0))
		pygame.display.update()
		if twoPlayerRect.collidepoint(pygame.mouse.get_pos()):
			twoPlayer = fontObject.render("Two Player", True, (0, 255, 0))
			screen.blit(twoPlayer, (265, 265))
			pygame.display.update()
			if event.type == pygame.MOUSEBUTTONDOWN:
				game.main(True, False, False, False)
		elif playComputerRect.collidepoint(pygame.mouse.get_pos()):
			playComputer = fontObject.render("Play Computer", True, (0, 255, 0))
			screen.blit(playComputer, (250, 345))
			pygame.display.update()
			if event.type == pygame.MOUSEBUTTONDOWN:
				while True:
					for event in pygame.event.get():
						if event.type == pygame.QUIT:
							sys.exit()
					board = clearBoard
					whiteButton = fontObject.render("Play as White", True, (255, 0, 0))
					blackButton = fontObject.render("Play as Black", True, (255, 0, 0))
					whiteButtonRect = pygame.Rect([240, 240, 160, 80])
					blackButtonRect = pygame.Rect([240, 400, 160, 80])
					pygame.draw.ellipse(board, (0, 0, 255), whiteButtonRect)
					pygame.draw.ellipse(board, (0, 0, 255), blackButtonRect)
					screen.blit(board, (0, 0))
					screen.blit(whiteButton, (255, 265))
					screen.blit(blackButton, (255, 425))
					pygame.display.update()
					if whiteButtonRect.collidepoint(pygame.mouse.get_pos()):
						whiteButton = fontObject.render("Play as White", True, (0, 255, 0))
						screen.blit(whiteButton, (255, 265))
						pygame.display.update()
						if event.type == pygame.MOUSEBUTTONDOWN:
							game.main(False, True, True, False) 
					elif blackButtonRect.collidepoint(pygame.mouse.get_pos()):
						blackButton = fontObject.render("Play as Black", True, (0, 255, 0))
						screen.blit(blackButton, (255, 425))
						pygame.display.update()
						if event.type == pygame.MOUSEBUTTONDOWN:
							game.main(False, True, False, True)
		elif quitRect.collidepoint(pygame.mouse.get_pos()):
			quitButton = fontObject.render("QUIT", True, (0, 255, 0))
			screen.blit(quitButton, (295, 425))
			pygame.display.update()
			if event.type == pygame.MOUSEBUTTONDOWN:
				sys.exit()