示例#1
0
def save():

	global couleur_balle
	global couleur_raquette_droite
	global couleur_raquette_gauche
	global couleur_arriere_plant
	global vitesse_balle
	global limite_points

	global tk
	global input_limite_points
	global input_couleur_raquette_gauche
	global input_couleur_raquette_droite
	global input_couleur_balle
	global input_vitesse_balle
	global input_couleur_arriere_plant

	couleur_balle = input_couleur_balle.get()
	couleur_raquette_droite = input_couleur_raquette_droite.get()
	couleur_raquette_gauche = input_couleur_raquette_gauche.get()
	couleur_arriere_plant = input_couleur_arriere_plant.get()
	vitesse_balle = input_vitesse_balle.get()
	limite_points = input_limite_points.get()

	if (couleur_arriere_plant == "" or couleur_arriere_plant == None):
		couleur_arriere_plant = "#1C2833"

	if (couleur_balle == "" or couleur_balle == None):
		couleur_balle = "#fff"

	if (couleur_raquette_gauche == "" or couleur_raquette_gauche == None):
		couleur_raquette_gauche = "#fff"

	if (couleur_raquette_droite == "" or couleur_raquette_droite == None):
		couleur_raquette_droite = "#fff"

	if (vitesse_balle == "" or vitesse_balle == None):
		vitesse_balle = 2

	if (limite_points == "" or limite_points == None):
		limite_points = 8

	with open('settings.pkl', 'wb') as settingsWrite:
		pickle.dump([couleur_balle, couleur_raquette_droite, couleur_raquette_gauche, couleur_arriere_plant, vitesse_balle, limite_points], settingsWrite)

	with open('settings.pkl', 'rb') as settingsFile:
	    print(pickle.load(settingsFile))

	tk.destroy()
	menu.start()
示例#2
0
 def login_button_Cmd(self, event=None):
     if len(self.coon) > 0 and self.coon == "noCoon":
         showinfo(title='提示', message='未连接到服务器,请检查你的网络!')
     else:
         validate = self.verifyAccountData()
         # 管理界面
         if validate == 'master':
             # self.root.destroy()
             # gui_user_manage.start()
             pass
         # 用户界面
         elif validate == 'user':
             login_qq = self.GG_Text_NumberVar.get()
             print("登录成功")
             # self.create_session()
             # self.insert_session()
             self.top.destroy()
             menu.start(login_qq)
         elif validate == 'noAccount':
             showinfo(title='提示', message='该账号不存在请重新输入!')
         elif validate == 'noPassword':
             showinfo(title='提示', message='账号/密码错误请重新输入!')
示例#3
0
# coding=utf-8
import pygame
import config
import towerdefense
import player
import game
import menu

menu = menu.Menu()
menu.start()

# game = game.Game()
# game.start()
# player = player.Player("Vinicius")
# towerDefense = towerdefense.TowerDefense(player, "maps/map1.map")

# while not game.getGameExit():

#     mousePosition = game.getMousePosition()

#     for event in game.getEvents():
#         if event.type == pygame.QUIT:
#             game.setGameExit()
#         if event.type == pygame.MOUSEBUTTONDOWN:
#             towerDefense.mousePress(game.getMousePosition(), game.getGameDisplay())
#         if event.type == pygame.KEYDOWN:
#             if event.key == pygame.K_f:
#                 if game.isFPSOn():
#                     game.turnOffFPS()
#                 else:
#                     game.turnOnFPS()
示例#4
0
        # phase 4: Travel Phase
        distance, g_dist = t.travel_phase(distance, distance_traveled, g_dist)

        # Check for win conditions
        if ed.win(distance):

            break

        # Check for loss conditions
        if ed.lose(fuel, food, power, hull, crew, morale, g_dist):

            break


# Display menu, run game loop, ask player if they want to play again
if m.start():

    # begin play again loop
    playing = True
    while playing == True:

        game_loop()

        # Prompt user for play again if true continue loop if false break loop
        if play_again() == True:

            pass

        else:

            break
示例#5
0
def main():
    global stdscr

    print BT_LOGO
    time.sleep(1)

    try: # Crash protection ;)
        init.init()
        stdscr = init.stdscr

        h, w = stdscr.getmaxyx()

        # Create falco and put him into the map
#        falco = Person(-1, "Falco", -1, [0, 0], ["F", curses.COLOR_WHITE, curses.COLOR_BLUE],
#                   configs.colorof["falco"][0])
#        falco.jumpTo(1, 0)
#        falco.crashWith = FalcoCrashMike

        theWorld = world.World(stdscr, w, h)

        # Mike is the hero!
        mike = Player(theWorld.statusBox, -1, "Du", -1, [0, 0], ["M", curses.COLOR_BLACK, curses.COLOR_RED],
                      configs.colorof["mike"][0], profile={"hp": [100, 100],
                                                       "mp": [0, 0]})

        # Adding mike and falco to Bermuda Triangle World
        theWorld.setPlayer(mike)
#        theWorld.addPerson(falco)

        theWorld.setCheatWalkEverywhere(False)

        # Adding water in map (mike cannot move on it)
        for i in range(10):
            theWorld.gMaps[1][1].gMap[10][i] = ["~", curses.COLOR_WHITE, curses.COLOR_BLUE, True, nothing]
        for i in range(10):
            theWorld.gMaps[1][0].gMap[10][198-i] = ["~", curses.COLOR_WHITE, curses.COLOR_BLUE, False, nothing]

        theWorld.load("testsave")
    
    
        while 1:                     # Gameloop
            timer.fpsDelay()         # FPS-Control
            clearError()
                                     # +++ Event handling +++
            c = stdscr.getch()       # I don't think an eventloop is needed in a
                                     # textadventure
            if c == ord("q"):
                theWorld.sendText("Bitte im Menue Beenden ('m' druecken)")
            if c == ord("w"): # Switches between colored and b/w
                misc.COLORED = not misc.COLORED
                theWorld.redrawAllMaps()
            if c == ord("m"): menu.start() # Enter menu
            if c == ord("h"): theWorld.playerGoLeft()  #
            if c == ord("j"): theWorld.playerGoDown()  #  Player
            if c == ord("k"): theWorld.playerGoUp()    #  movement
            if c == ord("l"): theWorld.playerGoRight() #
            if c == ord("s"): theWorld.load("testsave.btt")  # Loading doesn't really work ;)
            if c == ord("x"): theWorld.sendText(str(mike.gMap.pos))
            # --- Event handling ---

            # +++ Drawing +++
            oldH = h   # Need this for resizing
            oldW = w
            h, w = stdscr.getmaxyx()
            #stdscr.erase()
            # Window size exception
            if (w < 70) | (h < 24):
                stdscr.erase()
                stdscr.addstr(h/2, (w - len(BT_WINDOW_TOO_SMALL)) / 2,
                              BT_WINDOW_TOO_SMALL)
            elif misc.BT_ERROR != "":
                stdscr.addstr(h/2, (w - len(misc.BT_ERROR)) / 2,
                              misc.BT_ERROR)
            else:
                # Check for resize event
                if (oldH != h) | (oldW != w):
                    stdscr.erase()  # Have to clear the whole screen. Maybe this should do the theWorld object...
                    theWorld.resize(w, h)

                # Painting wonderful border ;)
                stdscr.box()
                stdscr.addstr(0, (w - len(BT_SMALL_LOGOTEXT)) / 2,
                              BT_SMALL_LOGOTEXT)

                theWorld.draw(stdscr)
                waveWare(w - 10, h - 1, stdscr)

            stdscr.refresh()
        # --- Drawing ---
    
        init.quit()

    except SystemExit:   # This is not really an error so there happens nothing
        pass
    except:              # If there was an error python will do this:
        # Exiting curses
        curses.nocbreak()
        stdscr.keypad(0)
        curses.echo()
        curses.endwin()

        # Telling there is went something wrong
        print "Hardcore error in Bermuda Triangle " + BT_VERSION + " :`(  Exiting forced!!!"
        print "Please send bt_last_error.log and a  description what you did"
        print "to [email protected]"

        # Writing error to file
        errorFile = file("bt_last_error.log", "w")
        errorFile.write("Error in Bermuda Triangle Text - Version " + BT_VERSION + "\n")
        traceback.print_exc(file=errorFile)
        errorFile.close()

        # If debug is switched on it will print the error to stdout
        if misc.DEBUG:
            traceback.print_exc()
示例#6
0
def main():
    menu.start()
示例#7
0
 menu.start([
     {
         'icon': 'bulb.png',
         'action': 'asd',
     },
     {
         'icon': 'bulb.png',
         'action': 'dsa',
     },
     {
         'icon': 'back.png',
         'action': menu.BACK,
     },
     {
         'icon': 'back.png',
         'action': [
             {
                 'icon': 'bulb.png',
                 'action': 'asd',
             },
             {
                 'icon': 'bulb.png',
                 'action': 'dsa',
             },
             {
                 'icon': 'back.png',
                 'action': menu.BACK,
             },
             {
                 'icon': 'back.png',
                 'action': menu.BACK,
             },
             {
                 'action': None,
             },
             {
                 'icon': 'back.png',
                 'action': turn_on_gpio,
             },
         ],
     },
     {
         'action': None,
     },
     {
         'icon': 'back.png',
         'action': turn_on_gpio,
     },
 ], 640, 480, 3, 3)
示例#8
0
tile_images = {
    'gold': load_image('gold.png'),
    'empty1': load_image('grass1.png'),
    'empty2': load_image('grass2.png'),
    'none': load_image('none.png')
}

was_on_gold = {
    "red": False,
    "blue": False,
    "black": False
}

joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]

playerskolvo = start(Board, SelectImage, generate_level)

level, maximum = load_level("map" + str(playerskolvo) + "_" + str(randrange(1, 6)) + ".txt")
selected_cell = (4, 4)
board = Board(playerskolvo, left, top, maximum)
generate_level(level, board, left, top)

SLEEPEVENT = pygame.USEREVENT + 1
sleeptime = 1000 * 60
pygame.time.set_timer(SLEEPEVENT, sleeptime)
sleepevent_was = False
f = False

fon = pygame.transform.scale(load_image('fon.png'), (width, height))

lines = open("settings.txt", encoding="utf8", mode="r").readlines()
示例#9
0
# platform
MOVE_RATE = 1
brain = new_classes.PlatformBrain()

platformCoords = [[400, 275]]
allPlatForms = [new_classes.Ground(win, 'dungeon', platformCoords[0], 50)]
allSprites.add(allPlatForms[0])
platforms.add(allPlatForms[0])

# Wall
wall = [new_classes.Wall(win, 'dungeon', [150, 250], 100)]
allSprites.add(wall[0])
platforms.add(wall)

#main menu
done = menu.start(win)

#game
while not done:
    #fill screen with black
    win.fill((0, 0, 0))

    for event in pg.event.get():
        if event.type == pg.QUIT:
            done = True
    '''     
    # Checks if touching ground
    # Go through all Ground new_classes and sees if they collide with the player.
    isTouchingGround = False
    for i in range(0, len(ground)):
        if ground[i].touchingGround(player.coords):
示例#10
0
from consts import *
import menu
import reactions
import chimp

win = pg.display.set_mode((WIDTH, HEIGHT))
pg.display.set_caption(TITLE_TEXT)

scores = {x: 0 for x in GAME_NAMES}

menu = menu.Menu(win)

clock = pg.time.Clock()

is_running = True

if __name__ == '__main__':
    # Main game loop
    while True:
        selection = menu.start()

        print(selection)

        if selection == 'Reactions':
            scores['Reactions'] = reactions.Reactions(win).start()

        elif selection == 'Chimp Test':
            pass
            # scores['Chimp Test'] = chimp.ChimpTest(win).start()