def ventana(numero): width = 900 height = 600 empezar = True pygame.init() posX = 100 posY = 250 pygame.display.set_caption("Prueba") auxDirector = Director() if numero == 1: auxDirector.setBuilder(GokuBuilder()) else: if numero == 0: auxDirector.setBuilder(MegamanBuilder()) charac = auxDirector.getChar() charac.defPositions(posX, posY) background = loadImages.load("background/mexBack.jpeg") screen = pygame.display.set_mode((width, height)) while empezar: for i in pygame.event.get(): if i.type == QUIT: pygame.quit() sys.exit() empezar = False screen.blit(background, (0, 0)) charac.update() charac.drawCharacter(screen) pygame.display.update()
def getDirector(): global director if director: return director else: import Director director = Director.Director() return director
class Game(): i = 0 width = 900 height = 600 colour = (227, 166, 162) empezar = True Gaticornio = rightGaticornio() auxlist = Gaticornio.get_sprites() pygame.init() posX = 100 posY = 320 posTup = (posX, posY) screen = pygame.display.set_mode((width, height)) pygame.display.set_caption("Prueba") speed = 20 auxDirector = Director() auxDirector.setBuilder(GaticornioMoves()) charac = auxDirector.getChar() charac.defPositions(posX, posY) jugando = True background = loadImages.load("background/espace.jpg") segundos = 0 pygame.mixer.music.load('Ragnarok.mp3') pygame.mixer.music.set_endevent(pygame.constants.USEREVENT) pygame.mixer.music.play() while empezar: for i in pygame.event.get(): if i.type == QUIT: score.main(segundos) pygame.quit() empezar = False sys.exit() elif i.type == pygame.constants.USEREVENT: pygame.mixer.music.load('Ragnarok.mp3') pygame.mixer.music.play() screen.blit(background, (0, 0)) charac.update() charac.drawCharacter(screen) charac.drawCaida(screen) pygame.display.update() empezar = charac.colisiones() segundos += 0.06
class Juego(): i=0 width = 900 height = 600 colour = (227,166,162) empezar = True opc = 0 pygame.init() posX=100 posY=250 posTup = (posX,posY) screen = pygame.display.set_mode((width, height)) pygame.display.set_caption("Prueba") speed=20 while opc != 1 and opc !=2: print ("Para elegir tu personaje ingresa:") print ("1-->Personaje Adaptado \n 2---> Personaje por defecto") opc = int(input()) auxDirector = Director() if opc == 1: auxDirector.setBuilder(jugUnoBuilder()) elif opc == 2: auxDirector.setBuilder(GokuBuilder()) charac = auxDirector.getChar(opc) charac.defPositions(posX,posY) jugando =True background = loadImages.load("background/mexBack.jpeg") while empezar: for i in pygame.event.get(): if i.type == QUIT: pygame.quit() empezar = False sys.exit() screen.blit(background,(0,0)) charac.update() charac.drawCharacter(screen) pygame.display.update()
def main(): # Array of scenes that shall be passed to the director scenes = [] # The "Director" of the game. It takes in the array of scenes and holds most of the "background" data for the game dire = Director(scenes) # The Scenes of the game. They all take the director object as an argument titlescr = TitleScreen(dire) onep = EdiblesOnePlayer(dire) twop = EdiblesTwoPlayer(dire) config = Config(dire) # Here the scenes are being appended to the end of the array scenes.append(titlescr) scenes.append(onep) scenes.append(twop) scenes.append((config)) # Changes/Sets the first scene of the game to be the Title Screen. dire.change_scene(titlescr) # Starts the game loop dire.loop()
class Juego(): i = 0 width = 900 height = 600 colour = (227, 166, 162) empezar = True megaman = rightMegaman() auxlist = megaman.get_sprites() pygame.init() posX = 100 posY = 250 posTup = (posX, posY) screen = pygame.display.set_mode((width, height)) pygame.display.set_caption("Prueba") speed = 20 auxDirector = Director() auxDirector.setBuilder(GokuBuilder()) charac = auxDirector.getChar() charac.defPositions(posX, posY) jugando = True background = loadImages.load("background/mexBack.jpeg") while empezar: for i in pygame.event.get(): if i.type == QUIT: pygame.quit() empezar = False sys.exit() screen.blit(background, (0, 0)) charac.update() charac.drawCharacter(screen) pygame.display.update()
if self.game_ball.rect.bottom > c.display_heigth: self.vidas -= 1 wait_init = True if self.vidas <= 0: self.game_over() self.change_scene('GameOver') def Draw(self, screen): self.display_game.blit(self.img_bg, (0, 0)) self.display_game.blit(self.game_ball.image, self.game_ball.rect) self.display_game.blit(self.game_player.image, self.game_player.rect) self.game_wall.draw(self.display_game) text = self.font.render( str(self.player_points).zfill(5), True, (255, 255, 255)) text_rect = text.get_rect() text_rect.topleft = [0, 0] lifeEnca = "vidas: " + str(self.vidas).zfill(2) life_txt = self.font.render(lifeEnca, True, (255, 255, 255)) life_text_rect = life_txt.get_rect() life_text_rect.topright = [c.display_width, 0] self.display_game.blit(text, text_rect) self.display_game.blit(life_txt, life_text_rect) director = Director('Arkanoid', (c.display_width, c.display_heigth)) director.addScene('Level1') director.execute('Level1')
def __init__(self): self.director = Director()
def sec_bias_test(): direct = Director.Director() s_list = direct.db_access() direct.set_master_list(s_list) direct.run_bias_analysis()
import SousEngineer newMultinationale = Multinationale.Multinationale("RCAT", "FRANCE") FilTun = Subsidiaries.Subsidiaries("RCAT-Tunisie","Tunisie",2012) FilBel = Subsidiaries.Subsidiaries("RCAT-Belgique","Belgique",2016) FilMar = Subsidiaries.Subsidiaries("RCAT-Maroc","Maroc",2008) FilAng = Subsidiaries.Subsidiaries("RCAT-Angleterre","Angleterre",2014) newMultinationale.addSubsidiaries(FilTun) newMultinationale.addSubsidiaries(FilBel) newMultinationale.addSubsidiaries(FilMar) newMultinationale.addSubsidiaries(FilAng) directTuni = Director.Director(10,"VAZ","Yanice",1452,"Tunisie",2017) FilTun.addSalarie(directTuni) admiTuni = Administration.Administration(8,"GROLLEAU","Alexis",2014,"Tunisie",2013,60,"Secrétaire") IngeSeniorTuni = SousEngineer.Senior(7,"RUER","Nathan",1850,"Tunisie",2012,60,80,60,"Programmation") FilTun.addSalarie(admiTuni) FilTun.addSalarie(IngeSeniorTuni) IngeSeniorMaroc = SousEngineer.Senior(7,"GABORIAU","Angele",1450,"Maroc",2013,60,70,90,"Ingé Son") FilMar.addSalarie(IngeSeniorMaroc) admiBelg = Administration.Administration(8,"MOCK","Mael",1454,"Belgique",2015,50,"Secrétaire") IngeJunBelg = SousEngineer.Senior(1,"LEFEBVRE","Eloise",1450,"Belgique",2013,60,70,90,1) FilBel.addSalarie(admiBelg) FilBel.addSalarie(IngeJunBelg)
sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) client_address = False print("For testing, how many windows should the server have?: ") win = input() port = 12222 # this is what the client has as of writing this print("------\nEnter the port this server should listen on (by default client sends to 12222): ") port = int(input()) server_address = ('localhost', port) print('starting up on {} port {}'.format(*server_address)) sock.bind(server_address) director = Director.Director() scrapPacket = Packet.Packet() lock = threading.Lock() director.windowNum = int(win) starttime = False def listen(): inData = None global starttime inData, address = sock.recvfrom(1500) lock.acquire() global client_address if not client_address: client_address = address
from Manager import * from Director import * from Employee import * def bulk_raise(list_of_emps): for emp in list_of_emps: emp.give_raise() emp_a = Employee(101, 45000) emp_b = Manager(103, 60000) emp_c = Director(105, 70000) list_of_emps = [emp_a, emp_b, emp_c] bulk_raise(list_of_emps) print(emp_a.salary) print(emp_b.salary) print(emp_c.salary)