def main(): root = Tk() StartMenu(root) root.mainloop() window = Tk() Graphic(window) window.mainloop() result = Tk() Result(result) result.mainloop()
def drawScreen(): global pokemon if mousePressed: if mouseX in range(55, 167) and mouseY in range(232, 364): pokemon = "squirtle" Battle_Screen.lil = True setSelectionState(False) Adventure.setAdventureState(True) StartMenu.setStartState(False) Battle_Screen.setBattleState(False) Adventure.setupScreen() Lil = True if mouseX in range(241, 362) and mouseY in range(244, 344): pokemon = "bulbasaur" Battle_Screen.blub = True setSelectionState(False) Adventure.setAdventureState(True) StartMenu.setStartState(False) Battle_Screen.setBattleState(False) Adventure.setupScreen() Bul = True if mouseX in range(426, 564) and mouseY in range(227, 361): pokemon = "charmander" Battle_Screen.cha = True setSelectionState(False) Adventure.setAdventureState(True) StartMenu.setStartState(False) Battle_Screen.setBattleState(False) Adventure.setupScreen() Cha = True
def main(): #global MainGame # Create the menu object. Set it up and run in # Might implement the setup inside the run function later Menu = StartMenu.StartMenu() Menu.setup() Run_Game = Menu.run() # If the menu returns a true for the run button being pressed then run the simulator if Run_Game: #MyGame.Game.init(1920, 1080, True) # Create the MyGame object with global constants setup by the start menu and run it MainGame = MyGame.Game(GC.ScreenWidth, GC.ScreenHeight, GC.FullScreen) MainGame.Game_Loop()
MOVE = True if not MOVE: #print "Ned hits wall" pass tart.update() def draw(self): self.rect = Rect(self.pos_x, self.pos_y, 28, 28) if self.flip == 5: self.image = pygame.transform.flip(self.image, 1, 0) screen.blit(self.image, (self.pos_x, self.pos_y)) if self.flip == 5: self.flip = 0 #Comp_Logo.run() StartMenu.play() tart = Pie() NED_MAZE = Maze_Map() ned = Ned_Movement() screen.fill((250, 250, 250)) bkg_spr = pygame.sprite.Group(NED_MAZE) clock = pygame.time.Clock() pygame.mouse.set_visible(False) while True: for e in pygame.event.get(): if e.type == QUIT: pygame.mouse.set_visible(True) pygame.quit() exit(0)
# Program by @SMP03 (https://github.com/SMP03) # Third-party libraries import pickle as pck import random import tkinter as tk from sys import exit from tkinter import ttk from tkinter import filedialog # Import start window and visual widgets import Showcase import StartMenu # Create the starter window and assign net to myNet starter_window = StartMenu.StartWindow() myNet = starter_window.net data_path = starter_window.database_path # Main Window root = tk.Tk() root.geometry("{0}x{1}+0+0".format(1000, 665)) # Window Size root.resizable(width=False, height=False) # Avoid resizing by user root.title("MNIST Neural Network") # Window Title root.protocol("WM_DELETE_WINDOW", exit) # Set cross button to end program # Load training data with open(data_path, "rb") as file: data, data_labels, a, c = pck.load(file) # Number of partitions of each epoch (Used for getting accuracy readings mid-epoch) steps = 4
import CheckSign import IfWin from os import system #Zadeklarowanie tablicy tablic, która ma puste miejsca do rysowania pierwszej pustej planszy boardSpace = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']] #Zadeklarowanie zmiennych player1 = "X" #Zmienna przechowywująca znak pierwszego gracza player2 = "" #Zmienna przechowywująca znak drugiego gracza computer = "" #Zmienna przechowywująca znak komputera youTurn = False #Zmienna przechowywująca turę gracza a = 0 #Zmienna wprowadzania wyboru przez gracza #Menu startowe. Wybór graczy do gry StartMenu.StartMenu() #Walidacja wprowadzanej wartośni while a != 1 and a != 2: try: a = int(input("Zdecyduj:")) except: a = 0 #Przypisanie drugiego gracza do rozgrywki if a == 1: computer = "O" else: player2 = "O" #Przypisywanie zaczynającego gracza
def back_btn_func(): win_search.hide() StartMenu.open_start_menu(win_search.x, win_search.y, db_dict)
def drawScreen(): global newCity,city global backgroundImg,sprite global playerX,playerY global grassBLX,grassBLY,pokeBLX,pokeBLY global frontFacing,backFacing,leftFacing,rightFacing image(backgroundImg,0,0,600,600) image(sprite,playerX,playerY,25,25) playerMiddleX = playerX + 12 playerMiddleY = playerY + 12 if (keyPressed): if (key == 'w'): sprite = backFacing playerY -= 2 elif(key == 's'): sprite = frontFacing playerY += 2 elif(key == 'a'): sprite = leftFacing playerX -= 2 elif(key == 'd'): sprite = rightFacing playerX += 2 if playerX in range(pokeBLX1,pokeBLX1 + 25) and playerY in range(pokeBLY1,pokeBLY1 + 25) or playerX in range(pokeBLX2,pokeBLX2 + 25) and playerY in range(pokeBLY2,pokeBLY2 + 25) : # print("detect bot left") setAdventureState(False) PokeSelection.setSelectionState(False) StartMenu.setStartState(False) Battle_Screen.setBattleState(True) Battle_Screen.setupScreen() elif playerX in range(pokeBRX1,pokeBRX1 + 25) and playerY in range(pokeBRY1,pokeBRY1 + 25) or playerX in range(pokeBRX2,pokeBRX2 + 25) and playerY in range(pokeBRY2,pokeBRY2 + 25): # print("detect bot right") setAdventureState(False) PokeSelection.setSelectionState(False) StartMenu.setStartState(False) Battle_Screen.setBattleState(True) Battle_Screen.setupScreen() elif playerX in range(pokeTRX1,pokeTRX1 + 25) and playerY in range(pokeTRY1,pokeTRY1 + 25) or playerX in range(pokeTRX2,pokeTRX2 + 25) and playerY in range(pokeTRY2,pokeTRY2 + 25) : # print("detect top right") setAdventureState(False) PokeSelection.setSelectionState(False) StartMenu.setStartState(False) Battle_Screen.setBattleState(True) Battle_Screen.setupScreen() elif playerX in range(pokeTLX1,pokeTLX1 + 25) and playerY in range(pokeTLY1,pokeTLY1 + 25) or playerX in range(pokeTLX2,pokeTLX2 + 25) and playerY in range(pokeTLY2,pokeTLY2 + 25) : # print("detect top left") setAdventureState(False) PokeSelection.setSelectionState(False) StartMenu.setStartState(False) Battle_Screen.setBattleState(True) Battle_Screen.setupScreen() #To get the boundaries print mouse x mouse y and get top right bot left corner if playerX in range(0,328) and playerY in range(285,347): #Left River if playerY < 325: playerY = 284 else: playerY = 348 elif playerX in range(375,541) and playerY in range(285,347): #Right River if playerY < 325: playerY = 284 else: playerY = 348 elif playerX > 507: #Right Trees playerX = 506 elif playerX < 28 and playerY in range(285,600): playerX = 29 elif playerX in range(0,328) and playerY > 527: playerY = 526 elif playerX in range(385,600) and playerY > 527: playerY = 526 elif playerY > 585: backgroundImg = newCity playerX = 332 playerY = 25 elif playerY < 6: backgroundImg = city playerX = 350 playerY = 580
def back_btn_func(): win_teams.become_target() StartMenu.open_start_menu(win_teams.x, win_teams.y, db_dict) win_teams.hide()
def back_btn_func(): StartMenu.open_start_menu(win_files.x, win_files.y, db_dict) win_files.hide()
def drawScreen(): global HealthBoxY, HealthBoxB, health global enemyHealth, Health, enemyattacklist, enemypicturelist, enemy global run, playersTurn enemyattacklist = [70, 60, 10] if timer.timeElapse() > 950: playersTurn = True if enemyHealth <= 0: Adventure.setupScreen() StartMenu.setStartState(False) PokeSelection.setSelectionState(False) setBattleState(False) Adventure.setAdventureState(True) if Health <= 0: StartMenu.setupScreen() StartMenu.setStartState(True) PokeSelection.setSelectionState(False) setBattleState(False) Adventure.setAdventureState(False) if mousePressed and mouseX >= 410 and mouseX <= 550 and mouseY >= 480 and mouseY <= 532: run = True Adventure.setAdventureState(True) Adventure.setupScreen() # bulbaTrap's attacks if bulb == True: img2 = loadImage("gold-silver-back.png") image(img2, 95, 325, 120, 120) image(enemy, 395, 115, 150, 150) # growl if mousePressed and playersTurn == True and mouseX <= 190 and mouseX >= 40 and mouseY <= 540 and mouseY >= 490: enemyHealth = enemyHealth - 25 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) #tackle if mousePressed and playersTurn == True and mouseX >= 30 and mouseX <= 180 and mouseY <= 490 and mouseY >= 50: enemyHealth = enemyHealth - 30 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # vine whip if mousePressed and playersTurn == True and mouseX <= 355 and mouseX >= 205 and mouseY >= 450 and mouseY <= 500: enemyHealth = enemyHealth - 70 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # toxic if mousePressed and playersTurn == True and mouseX >= 205 and mouseX <= 355 and mouseY >= 510 and mouseY <= 560: enemyHealth = enemyHealth - 50 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # cha fuego's attacks if cha == True: image(enemy, 395, 115, 150, 150) img2 = loadImage("charback.png") image(img2, 100, 350, 100, 100) # scratch if mousePressed and playersTurn == True and mouseX <= 190 and mouseX >= 40 and mouseY <= 540 and mouseY >= 490: enemyHealth = enemyHealth - 40 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # slash if mousePressed and playersTurn == True and mouseX >= 30 and mouseX <= 180 and mouseY <= 490 and mouseY >= 50: enemyHealth = enemyHealth - 70 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # ember if mousePressed and playersTurn == True and mouseX <= 355 and mouseX >= 205 and mouseY >= 450 and mouseY <= 500: enemyHealth = enemyHealth - 40 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # fire spin if mousePressed and playersTurn == True and mouseX >= 205 and mouseX <= 355 and mouseY >= 510 and mouseY <= 560: enemyHealth = enemyHealth - 35 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # lil squirt attacks if lil == True: img2 = loadImage("squback.png") image(img2, 100, 310, 160, 160) image(enemy, 395, 115, 150, 150) # headbutt if mousePressed and playersTurn == True and mouseX <= 190 and mouseX >= 40 and mouseY <= 540 and mouseY >= 490: enemyHealth = enemyHealth - 70 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # tail whip if mousePressed and playersTurn == True and mouseX >= 30 and mouseX <= 180 and mouseY <= 490 and mouseY >= 50: enemyHealth = enemyHealth - 35 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # bubble if mousePressed and playersTurn == True and mouseX <= 355 and mouseX >= 205 and mouseY >= 450 and mouseY <= 500: enemyHealth = enemyHealth - 40 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) # water gun if mousePressed and playersTurn == True and mouseX >= 205 and mouseX <= 355 and mouseY >= 510 and mouseY <= 560: enemyHealth = enemyHealth - 40 playersTurn = False timer.startTimer() Health -= (enemyattacklist[randint(0, 2)]) #Update Health # fill(255) # rect(10, 15, 205, 50) # textSize(36) # fill(0) textSize(20) image(HealthBoxY, 10, 25, 205, 50) image(health, 25, 35) stroke(0) fill(0) text(enemyHealth, 110, 56) image(HealthBoxY, 380, 305, 205, 50) image(health, 395, 315) text(Health, 480, 335)
def menu_btn_func(): save_settings() StartMenu.open_start_menu(win_ultimate_teams.x, win_ultimate_teams.y, db_dict) win_ultimate_teams.hide()