Пример #1
0
 def __init__(self):
   Scene.__init__(self)
   self._screen = Screen()
   self._player = PlayerCharacter()
   self._floor = CurrentFloor()
   self._sight = Sight(self._player)
   self._floor.put_monster(Monster())
Пример #2
0
 def __init__(self, line_num, *args, **kwargs):
     self.line_num = line_num
     self.anim_kwargs = {
         "run_time" : 4.0,
     }
     self.line_num_to_method = {
         0  : self.line0,
         1  : self.line1,
         2  : self.line2,
         3  : self.line3,
         4  : self.line4,
         5  : self.line5,
         6  : self.line6,
         7  : self.line7,
         8  : self.line8,
         9  : self.line9,
         10 : self.line10,
         11 : self.line11,
         12 : self.line12,
         13 : self.line13,
         14 : self.line14,
         15 : self.line15,
         16 : self.line16,
         17 : self.line17,
         18 : self.line18,
         19 : self.line19,
     }
     Scene.__init__(self, *args, **kwargs)
Пример #3
0
 def __init__(self, nextScene, text="press enter...", *a):
     Scene.__init__(self, *a)
     self.nextScene = nextScene
     font = data.filepath('You Are Loved.ttf')
     figure = leafs.TextoAlineado(text, font, size=1000, alignx=0.5, aligny=0.5)
     self.group.add(figure)
     self.accept()
Пример #4
0
 def __init__(self):
     #Initialisation de la scene
     Scene.__init__(self)
     #Chargement de l'image de fond de la scene
     self.fond = fonction.charger_image("fond.jpg")
     #Chargement des objets
     self.bulles = bulles.Bulles()
     self.pointeur = pointeur.Pointeur(14,3) 
     self.poisson_1 = poisson.Poisson()
     self.poisson_2 = poisson.Poisson()
     self.poisson_3 = poisson.Poisson()
     self.poisson_4 = poisson.Poisson()
     
     #Chargement de la musique de fond 
     #self.musique = pygame.mixer.music.load("./sons/bouge.ogg")
     #self.musique.set_volume(0.5)
     #self.musique.fadeout(400) 
 
     #Chargement des textes à afficher
     self.texte_titre = fonction.Texte("Aquarium", 50, constante.noir)
     #Menu
     self.texte_menu_jouer = fonction.Texte(" > Jouer [J]",30, constante.bleufonce)
     self.texte_menu_credis = fonction.Texte(" > Credits [C]",30, constante.noir)
     self.texte_menu_quitter = fonction.Texte(" > Quitter [Q]",30, constante.noir)
     #joystick
     self.nb_joysticks = pygame.joystick.get_count()
     if self.nb_joysticks > 0:
         self.texte_joystick = fonction.Texte("Joystick ok", 20, constante.gris)
     else:
         self.texte_joystick = fonction.Texte("Pas de joystick", 20, constante.gris)
Пример #5
0
 def __init__(self):
     #Initialisation de la scene
     Scene.__init__(self)
     #Chargement de l'image de fond de la scene
     self.fond = fonction.charger_image("fond.jpg")
     #Chargement des objets
     self.bulles = bulles.Bulles() 
     self.pointeur = pointeur.Pointeur(15,24) 
     #self.pointeur.positionner(15,3) 
     self.poisson_1 = poisson.Poisson()
     self.poisson_2 = poisson.Poisson()
     self.poisson_3 = poisson.Poisson()
     self.poisson_4 = poisson.Poisson()
     
     #Chargement de la musique de fond 
     #self.musique = pygame.mixer.music.load("./sons/bouge.ogg")
     #self.musique.set_volume(0.5)
     #self.musique.fadeout(400) 
 
     #Chargement des textes à afficher
     self.texte_titre = fonction.Texte("Aquarium", 50, constante.noir)
     self.texte_stitre = fonction.Texte("Credits", 20, constante.gris)
     self.credis = credis.lire_credis()
     self.texte_credis = fonction.Texte_multiligne( (self.credis) )
     self.texte_credis.position(0, 0, 380, 65)
     self.texte_retour = fonction.Texte(" > Retour [R]",30, constante.bleufonce)
Пример #6
0
 def __init__(self, world, initial_option=0):
     Scene.__init__(self, world)
     items=[]
     for name,level in levels.levels:
         items.append( (name, runner(self.game, level) ) )
     items.append( ("back", self.on_back) )
     self.menu = Menu(self, items, initial_option)
Пример #7
0
    def __init__(self, game):
        Scene.__init__(self, game, ORTHOGONAL)
        self.centerMouse()
        self.ceilings = None
        self.lastPut = None
        self.horEnergy = True #riq's preferences
        self.world = world.World()
        self.ballsAtGoal = 0
        self.lost = 0
        self.llss = [] #limited life segments
        self.attractors = []
        self.root_node.background_color = CELESTE_CIELO
        self._energy = 2000
        self.cameraArea = self.CAMERA_AREA
        self.maxEnergy=3000
        import sound
        sound.playRandomSong()
        
        self.setup_level()
             
        mountainsGroup = qgl.scene.Group()
        mountainsTexture = qgl.scene.state.Texture(data.filepath("montagnas.png"))
        FACTOR= 5.5
        mountainsQuad = qgl.scene.state.Quad((2403/FACTOR,427/FACTOR))
        mountainsGroup.scale = (self.mountainScale, self.mountainScale, 0.0)
        mountainsGroup.translate = (0,-55.-70.0*(self.cameraArea[3])/500.,0)
        mountainsGroup.add(mountainsTexture, mountainsQuad)
        self.group.add(mountainsGroup)

        self.initLineGhost()
        self.group.scale = (5.0,5.0,0.0)
        self.initScores()
        self.updateScores()
        self.accept()
Пример #8
0
    def __init__(self, gurls, bg_surf=None, back_color=(234,45,30), back_pos=(40,500),
                 back_size=(70,40), back_font=None):
        Scene.__init__(self)
        self.gurls = gurls  # expect three
        self.bg_surf = bg_surf
        self.done = False
        self.choice = None

        def finish():
            self.done = True
        self.buttons.add(BlockButton(finish, back_color, back_size, back_pos,
                                     text="Back", font=back_font))
        self.gurl_sprites = pygame.sprite.Group()
        gurl_pos = [(100, 100), (300, 100), (500, 100)]

        def make_choice(gurl):
            self.done = True
            self.choice = gurl

        def make_gurl_sprite(gurl):
            pos = gurl_pos.pop(0)
            sprite = GurlSprite(gurl, pos)
            sprite.on_click = lambda: make_choice(gurl)
            self.gurl_sprites.add(sprite)

        make_gurl_sprite(Kanaya())
        make_gurl_sprite(Isadora())

        self.buttons.add(self.gurl_sprites)
        self.all_sprites.add(self.buttons, self.gurl_sprites)
        self.main_surface = pygame.display.get_surface()
Пример #9
0
 def __init__(self, nrows, *args, **kwargs):
     Scene.__init__(self, *args, **kwargs)
     self.nrows            = nrows
     self.diagram_height   = 2*SPACE_HEIGHT - 1
     self.diagram_width    = 1.5*SPACE_WIDTH
     self.cell_height      = self.diagram_height / nrows
     self.cell_width       = self.diagram_width / nrows
     self.portion_to_fill  = 0.7
     self.bottom_left      = np.array(
         (-self.cell_width * nrows / 2.0, -self.cell_height * nrows / 2.0, 0)
     )
     num_to_num_mob   = {} 
     self.coords_to_mobs   = {}
     self.coords = [(n, k) for n in range(nrows) for k in range(n+1)]    
     for n, k in self.coords:
         num = choose(n, k)              
         center = self.coords_to_center(n, k)
         if num not in num_to_num_mob:
             num_to_num_mob[num] = TexMobject(str(num))
         num_mob = num_to_num_mob[num].copy()
         scale_factor = min(
             1,
             self.portion_to_fill * self.cell_height / num_mob.get_height(),
             self.portion_to_fill * self.cell_width / num_mob.get_width(),
         )
         num_mob.center().scale(scale_factor).shift(center)
         if n not in self.coords_to_mobs:
             self.coords_to_mobs[n] = {}
         self.coords_to_mobs[n][k] = num_mob
     self.add(*[self.coords_to_mobs[n][k] for n, k in self.coords])
Пример #10
0
    def __init__(self, world):
        Scene.__init__(self, world)
        self.step = 0
        self._load_background()
        self.name = text.AboutText()
        self._create_sprites()

        pyglet.clock.schedule_once(self.show_losersjuegos_logo, 4 + 3 * 2)
Пример #11
0
 def __init__(self, world, game):
     Scene.__init__(self, world)
     self.game = game
     self.step = 0
     self._create_sprites()
     self.text = text.History("Good bye robot city...")
     self.texts = []
     pyglet.clock.schedule_once(self._create_text, 3)
Пример #12
0
 def __init__(self):
     #Initialisation de la scene
     Scene.__init__(self)
     #Chargement de l'image de fond de la scene
     self.fond = fonction.charger_image("fond.jpg")
     #Creation des objets.
     self.bulles = bulles.Bulles()
     self.nourriture = nourriture.Nourriture()
     self.poissons = poissons.Poissons()
Пример #13
0
    def __init__(self, game, last_option_in_main):
        Scene.__init__(self, game)
        items = [
                ("Fullscreen", self.game.fullscreen),
                ("Return", self.on_return)
                ]

        self.menu = Menu(self, items)
        self.last_option_in_main = last_option_in_main
Пример #14
0
    def __init__(self, world, start_music=True):
        Scene.__init__(self, world)
        self.step = 0
        self._create_sprites()
        self.background = common.load_image('black.png')
        self.text = text.Text(MSG_START, 170, 10)

        if start_music:
            self.world.audio.play_music('intro')
Пример #15
0
    def __init__(self, world, score=0):
        Scene.__init__(self, world)
        self.score = score

        self.root_node.background_color = view.CELESTE_CIELO
        am = self.actionManager = Manager()
        am.do( None,
            delay(10) +
            call(self.next)        
            )
Пример #16
0
 def __init__(self, director, page_number = False, previous = False, follow = False):
     '''
     Constructor
     '''
     Scene.__init__(self, director, False, page_number)
     self.previous = previous
     self.follow = follow
     self.prev_init = False          
     self.buttoms = {}
     self.buttoms[GO_SCHEME] = Buttom(config.page_btn_go_scheme_pos, config.page_btn_size, 'go_scheme_pressed'+PNG_EXT, 'go_scheme_release'+PNG_EXT, True)
Пример #17
0
 def __init__(self, director, background_hangman):
     '''
     Constructor
     '''
     Scene.__init__(self, director, background_hangman)        
     self.hangman = Hangman()
     self.scene_winner =  Sce_Winner(director, 'winner', HANGMAN_SCENE)
     
     for buttom in self.common_buttoms.itervalues():
         buttom.is_visible = True
Пример #18
0
 def __init__(self, director, background_name, continue_scene):
     '''
     Constructor
     '''
     Scene.__init__(self, director, background_name)
     for buttom in self.common_buttoms.itervalues():
         buttom.is_visible = True
     
     self.continue_scene = continue_scene         
     self.next_btn = Buttom((config.width/2, (config.height/2 + 150)), config.b_size, 'continue_pressed'+PNG_EXT, 'continue_release'+PNG_EXT, True) 
Пример #19
0
 def __init__(self, director, background_match):
     '''
     Constructor
     '''
     Scene.__init__(self, director, background_match)        
     self.definitions = Definitions()
     
     
     for buttom in self.common_buttoms.itervalues():
         buttom.is_visible = True
Пример #20
0
 def __init__(self, world, game):
     Scene.__init__(self, world)
     self.game = game
     self.step = 0
     self._load_images()
     self.are_showing_message = False
     self.texts = []
     self.layer = common.load_image('game_over_layer.png')
     self.show_layer = False
     pyglet.clock.schedule_once(self._create_game_over_text, 3)
Пример #21
0
    def __init__(self, world, initial_option=0):
        Scene.__init__(self, world)

        items = [
                 ("Start new game", self.on_new_game),
                 ("Option", self.on_options),
                 ("Credits", self.on_credits),
                 ("Quit", self.on_quit),
                 ]

        self.menu = Menu(self, items, initial_option)
Пример #22
0
 def __init__(self, director, background_name):
     '''
     Constructor
     '''
     Scene.__init__(self, director, background_name)        
     self.name = Name()
     self.scene_winner =  Sce_Winner(director, 'winner', NAME_SCENE)
     self.c_fails = 0
     self.name.generate_table()
     for buttom in self.common_buttoms.itervalues():
         buttom.is_visible = True
Пример #23
0
    def __init__(self, world):
        Scene.__init__(self, world)
        self.layer_x = 640
        self.layer_y = 0
        self._load_images()

        self.good_moves_combo = 0
        self.sprites = []
        self.upper_lights = []
        self.lower_ligths = []
        self.tv = tv.Tv()
Пример #24
0
 def __init__(self, director, background_match):
     '''
     Constructor
     '''
     Scene.__init__(self, director, background_match)        
     self.match = Match()
     self.scene_winner =  Sce_Winner(director, 'winner', MATCH_SCENE)
     self.c_fails = 0
     
     self.match.generate_table()
     for buttom in self.common_buttoms.itervalues():
         buttom.is_visible = True
Пример #25
0
 def __init__(self,gameEngine):
    Scene.__init__(self,gameEngine)
    
    self.particleManager = ParticleManager(self)
    self.gameObjects = []
    
    self.lives = 5
    self.spawn =(32,32) #coordinates that the player spawned on
    self.spawnTimer = 0
    
    self.level = 1
    self.loadLevel()
 def __init__(self, director, background_name):
     '''
     Constructor
     '''
     Scene.__init__(self, director, background_name)
     self.functional_group = Functional_Group()
     self.scene_winner =  Sce_Winner(director, 'winner', COTIDIAN_FUNCTION_SCENE)   
     
     for buttom in self.common_buttoms.itervalues():
         buttom.is_visible = True
     
     self.c_fails = 0
Пример #27
0
 def __init__(self,gameEngine):
    Scene.__init__(self, gameEngine)
    
    self.player = None
    self.objects = []
    
    self.spawn = (0,0) #spawn point of current level
    self.spawnTime = 0 #time until the player is respawned
    
    self.particleManager = ParticleManager(self)
    
    self.level = 1
    self.loadLevel()
Пример #28
0
	def __init__( self , maxt , fovy , ratio , near , far ) :
		Scene.__init__(self,fovy,ratio,near,far)

		self.maxt = maxt

		self.frame = Frame()

		self.b = np.array((-5,0,0) , np.float64 )
		self.c = np.array(( 0,0,0) , np.float64 )
		self.e = np.array(( 5,0,0) , np.float64 )

		self.qb = tr.random_quaternion()
		self.qc = self.qb
		self.qe = tr.random_quaternion()
Пример #29
0
	def __init__( self , maxt , fovy , ratio , near , far ) :
		Scene.__init__(self,fovy,ratio,near,far)

		self.maxt = maxt 

		self.frame = Frame()

		self.a = 0.0
		self.b = 0.0
		self.c = 0.0

		self.b = np.array((-5,0,0) , np.float64 )
		self.c = np.array(( 0,0,0) , np.float64 )
		self.e = np.array(( 5,0,0) , np.float64 )

		self.ab = np.array(( 0,0,0) , np.float64 )
		self.ac = self.ab
		self.ae = np.array((.5,.2,.1) , np.float64 )
Пример #30
0
 def __init__(self, director, background_name):
     '''
     Constructor
     '''        
     Scene.__init__(self, director, background_name)
     self.title_img = load_image(config.titles+'functional_groups'+PNG_EXT, True)
     self.title_img = pygame.transform.scale(self.title_img, (450, 150))
     self.title_rect = self.title_img.get_rect()
     self.title_rect.centerx = config.width / 2
     self.title_rect.centery = 80
     
     self.buttoms = {
                     DEFINITIONS_SCENE: Buttom((230, 180), config.b_size, "buttom_1_pressed"+PNG_EXT, "buttom_1_release"+PNG_EXT, True),                                                    
                     NAME_SCENE: Buttom((580, 180), config.b_size, "buttom_2_pressed"+PNG_EXT, "buttom_2_release"+PNG_EXT, True), 
                     COTIDIAN_FUNCTION_SCENE: Buttom((230, 300), config.b_size, "buttom_3_pressed"+PNG_EXT, "buttom_3_release"+PNG_EXT, True),
                     MATCH_SCENE: Buttom((580, 300), config.b_size, "buttom_4_pressed"+PNG_EXT, "buttom_4_release"+PNG_EXT, True),
                     ALPHABET_SOUP_SCENE: Buttom((230, 440), config.b_size, "buttom_5_pressed"+PNG_EXT, "buttom_5_release"+PNG_EXT, True),  
                     CRUCIGRAMA_SCENE: Buttom((580, 440), config.b_size, "buttom_6_pressed"+PNG_EXT, "buttom_6_release"+PNG_EXT, True),                        
                     HANGMAN_SCENE: Buttom((config.width / 2, 530), config.b_size, "buttom_7_pressed"+PNG_EXT, "buttom_7_release"+PNG_EXT, True)
                     }
Пример #31
0
    def __init__(self, game):
        Scene.__init__(self, game, ORTHOGONAL)
        self.centerMouse()
        self.ceilings = None
        self.lastPut = None
        self.horEnergy = True  #riq's preferences
        self.world = world.World()
        self.ballsAtGoal = 0
        self.lost = 0
        self.llss = []  #limited life segments
        self.attractors = []
        self.root_node.background_color = CELESTE_CIELO
        self._energy = 2000
        self.cameraArea = self.CAMERA_AREA
        self.maxEnergy = 3000
        import sound
        sound.playRandomSong()

        self.setup_level()

        mountainsGroup = qgl.scene.Group()
        mountainsTexture = qgl.scene.state.Texture(
            data.filepath("montagnas.png"))
        FACTOR = 5.5
        mountainsQuad = qgl.scene.state.Quad((2403 / FACTOR, 427 / FACTOR))
        mountainsGroup.scale = (self.mountainScale, self.mountainScale, 0.0)
        mountainsGroup.translate = (0,
                                    -55. - 70.0 * (self.cameraArea[3]) / 500.,
                                    0)
        mountainsGroup.add(mountainsTexture, mountainsQuad)
        self.group.add(mountainsGroup)

        self.initLineGhost()
        self.group.scale = (5.0, 5.0, 0.0)
        self.initScores()
        self.updateScores()
        self.accept()
Пример #32
0
    def __init__(self, game):

        Scene.__init__(self, game)
        import sound

        self.root_node.background_color = (0, 0, 0, 0)
        am = self.actionManager = Manager()

        luz = self.create_image("dad.png")
        luz.translate = Point3(60, -10, 0)
        luz.scale = (12, 4.5, 0)

        dad_hi = self.createDad()
        dad_hi.translate = Point3(150, -150, 0)

        script = [
            ("- hey...", 800),
            ("where am I?", 1800),
            ("this is not home!", 2000),
            ("my teleport spell must have failed", 2000),
            ("lets try again...", 2000),
            (" ", 2000),
            ("ouch!", 1700),
            ("this didn't work", 2000),
            ("I'll get help from above", 2300),
            ("I'm going up!", 2000),
        ]

        offset = 0
        lines = []
        for line, duration in script:
            l = self.create_line(line)
            lines.append((l, offset, duration))
            offset += duration

        nube = [self.create_image("nube%i.png" % i) for i in range(1, 6)]
        [setattr(n, "translate", Point3(150, -150, 0)) for n in nube]

        dad = self.create_image("dad.gif")
        dad.translate = Point3(-350, -150, 0)

        self.accept()
        dad_hi.disable()
        luz.disable()
        [n.disable() for n in nube]
        [n.disable() for (n, a, x) in lines]

        def enable(what):
            def doit():
                what.enable()

            return doit

        def disable(what):
            def doit():
                what.disable()

            return doit

        am.do(
            None,
            delay(20000) + call(lambda: musique("grossini talking 1.ogg")) +
            delay(10600) + call(lambda: musique("grossini talking 2.ogg")))
        am.do(
            dad,
            goto(Point3(150, -150, 0), duration=5000) +
            call(lambda: luz.enable()) +
            call(lambda: sound.playSoundFile("farol.wav", 1)) + delay(1500) +
            call(lambda: musique("Applause.wav")) + delay(2500) +
            call(lambda: dad.disable()) + call(lambda: dad_hi.enable()) +
            delay(6000) + call(lambda: sound.playSoundFile("MagiaOK.wav", 1)) +
            call(lambda: dad_hi.disable()) + delay(3000) +
            call(lambda: luz.disable()) +
            call(lambda: sound.playSoundFile("farol.wav", 1)))

        for (line, start, duration) in lines:
            am.do(
                line,
                delay(20000) + delay(start) + call(enable(line)) +
                delay(duration) + call(disable(line)))
        am.do(
            None,
            delay(20000 + 4 * 2000) +
            call(lambda: sound.playSoundFile("tomato.wav", 1)))
        am.do(
            None,
            delay(20000 + 5 * 2000) +
            call(lambda: setattr(self.root_node, "background_color",
                                 (1, 1, 1, 0))) + delay(100) +
            call(lambda: setattr(self.root_node, "background_color",
                                 (0, 0, 0, 0))) + delay(100) +
            call(lambda: setattr(self.root_node, "background_color",
                                 (1, 1, 1, 0))) + delay(100) +
            call(lambda: setattr(self.root_node, "background_color",
                                 (0, 0, 0, 0))) + delay(100))

        am.do(
            None,
            delay(20000 + duration + start) +
            call(lambda: self.game.change_scene(Intro(self.game, False))))

        def enable(what):
            def doit():
                what.enable()

            return doit

        def disable(what):
            def doit():
                what.disable()

            return doit

        for i, n in enumerate(nube):
            am.do(
                n,
                delay(15500) + delay(400 * i) + call(enable(n)) + delay(400) +
                call(disable(n)))
Пример #33
0
    def __init__(self, world, score=0):
        Scene.__init__(self, world)
        self.score = score

        self.root_node.background_color = view.CELESTE_CIELO
        self.font = filepath('You Are Loved.ttf')

        import sound
        self.initializeMusic()
        clouds = self.createClouds()
        clouds3 = self.createClouds()
        dad = self.createDad()
        clouds2 = self.createClouds()

        self.accept()

        diedline = self.diedline()
        scoretext = self.scoreline()
        scoretext.disable()
        diedline.disable()

        am = self.actionManager = Manager()
        am.do(clouds, place(Point3(-200, 200, 0)))

        dad.scale = Vector3(0.1, 0.1, 1)
        am.do(dad, place(Point3(0, 0, 0)))
        am.do(dad, repeat(rotate(360, duration=2100)))

        am.do(
            dad,
            scale(10, duration=10000) + spawn(call(scoretext.enable)) +
            delay(4000) + scale(10, duration=5000) +
            call(lambda: sound.playMusicSound(self.crash, 1)) +
            call(lambda: setattr(self.root_node, "background_color",
                                 ROJO_SANGRE)) + call(diedline.enable) +
            place(Point3(-2000, -2000, 0)))

        clouds2.scale = Vector3(20, 20, 1)
        am.do(clouds2, place(Point3(-5500, 3500, 0)))
        am.do(clouds2, goto(Point3(-600, 400, 0), duration=10000))

        am.do(clouds2,
              scale(1.0 / 10, duration=10000) + place(Point3(-1000, -1000, 0)))

        clouds.scale = Vector3(2, 2, 1)

        am.do(
            clouds,
            place(Point3(-1000, -1000, 0)) + delay(10000) +
            place(Point3(-600, 400, 0)) + delay(4000) +
            spawn(goto(Point3(-60, 40, 0), duration=5000)) +
            scale(1.0 / 10, duration=5000) + place(Point3(-1000, -1000, 0)))

        clouds3.scale = Vector3(5, 5, 1)

        am.do(
            clouds3,
            place(Point3(2000, -2000, 0)) + delay(10000) + delay(4000) +
            spawn(goto(Point3(200, -200, 0), duration=5000)) +
            scale(1.0 / 10, duration=5000) + place(Point3(2000, -2000, 0)))

        sound.playSoundFile("freefall.ogg", 1)
Пример #34
0
    def __init__(self, game):

        Scene.__init__(self, game)
        import sound

        self.root_node.background_color = (0, 0, 0, 0)
        am = self.actionManager = Manager()

        def enable(what):
            def doit():
                what.enable()

            return doit

        def disable(what):
            def doit():
                what.disable()

            return doit

        script = [
            ("Divine Inspiration", "David"),
            ("Magic", "Great Grossini"),
            ("Hosting", "leito"),
            ("Hosting", "alecu"),
            ("coding", "dave"),
            ("coding", "riq"),
            ("coding", "alecu"),
            ("coding", "hugo"),
            ("coding", "lucio"),
            ("Music", "Ricardo Vecchio"),
        ]

        offset = 0
        lines = []
        for cargo, nombre in script:
            l1 = self.create_line(cargo)

            l2 = self.create_line(nombre)
            l2.translate = (0, -00, 0)
            lines.append((l1, l2))

        self.accept()
        [(l1.disable(), l2.disable()) for (l1, l2) in lines]

        def make_title(line):
            l1, l2 = line
            do_title = (
                delay(100) +
                call(lambda: sound.playSoundFile("tomato.wav", 1)) +
                delay(2000) +
                call(lambda: setattr(self.root_node, "background_color",
                                     (1, 1, 1, 0))) + delay(100) +
                call(lambda: setattr(self.root_node, "background_color",
                                     (0, 0, 0, 0))) + delay(100) +
                call(lambda: setattr(self.root_node, "background_color",
                                     (1, 1, 1, 0))) + delay(100) +
                call(lambda: setattr(self.root_node, "background_color",
                                     (0, 0, 0, 0))) + delay(100) +
                call(lambda: setattr(l2, 'translate', Point3(0, 00, 0))) +
                call(lambda: setattr(l1, 'translate', Point3(0, 100, 0))) +
                call(lambda: setattr(l2, 'angle', 0)) +
                call(lambda: setattr(l1, 'angle', 0)) +
                call(lambda: l1.enable()) + call(lambda: l2.enable()) +
                delay(1500) +
                spawn(move(Point3(0, -600, 0), duration=1000), target=l1) +
                spawn(move(Point3(0, -600, 0), duration=1000), target=l2) +
                spawn(rotate(45, duration=1000), target=l1) +
                spawn(rotate(-45, duration=1000), target=l2) + delay(2500) +
                call(lambda: l1.disable()) + call(lambda: l2.disable()))
            return do_title

        am.do(None, random_repeat([make_title(line) for line in lines]))
Пример #35
0
 def __init__(self,gameEngine,win=False):
    Scene.__init__(self,gameEngine)
    self.win = win
Пример #36
0
    def __init__(self, world, menuEnable=0):
        Scene.__init__(self, world)

        self.root_node.background_color = view.CELESTE_CIELO

        clouds = self.createClouds()
        clouds2 = self.createClouds2()
        clouds3 = self.createClouds3()
        plane = self.createAirplane()
        devil = self.createDevil()
        jesus = self.createJesus()
        alien = self.createAlien()
        dad = self.createDad()
        varita = self.createVarita()

        self.accept()

        self.initMenus(menuEnable)

        self.actionManager = Manager()
        # cloud (background)
        self.actionManager.do(
            clouds,
            delay(DADDY_FALL) + repeat(
                call(lambda: setattr(
                    clouds, "translate",
                    Point3(random.randint(-100, 100), -200, 0))) +
                move(Point3(0, 1600, 0), duration=18000) +
                random_delay(2000, 4000)))

        self.actionManager.do(
            clouds2,
            delay(DADDY_FALL) + repeat(
                call(lambda: setattr(
                    clouds2, "translate",
                    Point3(random.randint(-100, 100), -200, 0))) +
                move(Point3(0, 1600, 0), duration=24000) +
                random_delay(2000, 5000)))

        self.actionManager.do(
            clouds3,
            delay(DADDY_FALL) + repeat(
                random_delay(2000, 6000) + call(lambda: setattr(
                    clouds3, "translate",
                    Point3(random.randint(-100, 100), -200, 0))) +
                move(Point3(0, 1600, 0), duration=12000)))

        # airplane
        self.actionManager.do(
            plane,
            repeat(
                random_delay(40000, 45000) + call(lambda: setattr(
                    plane, "translate",
                    Point3(600, random.randint(-300, 300), 0))) +
                move((-1500, 0, 0), duration=3000)))

        # devil
        self.actionManager.do(
            devil,
            repeat(
                random_delay(50000, 80000) +
                call(lambda: setattr(devil, "translate",
                                     Point3(random.randint(-380, 0), -600, 0)))
                +
                call(lambda: setattr(devil, "scale", Point3(0.75, 0.75, 1))) +
                move((0, 1500, 0), duration=30000)))

        # jesus
        self.actionManager.do(
            jesus,
            repeat(
                random_delay(30000, 70000) + call(
                    lambda: setattr(jesus, "translate",
                                    Point3(random.randint(0, 380), -600, 0))) +
                call(lambda: setattr(jesus, "scale", Point3(0.6, 0.6, 1))) +
                move((0, 1500, 0), duration=35000)))

        # alien
        self.actionManager.do(
            alien,
            repeat(
                random_delay(40000, 50000) + call(lambda: setattr(
                    alien, "translate",
                    Point3(random.randint(-400, 400), 600, 0))) +
                call(lambda: setattr(alien, "scale", Point3(0.9, 0.9, 1))) +
                move((0, -1500, 0), duration=30000)))

        # daddy
        action_fall = goto(Point3(0, 0, 0), duration=DADDY_FALL)
        action_rot = rotate(1080, duration=DADDY_FALL)
        action_rot2 = repeat(rotate(360, duration=16000 / 3))
        self.actionManager.do(dad, action_fall)
        self.actionManager.do(
            dad,
            call(self.playFreeFall) + delay(18000) + call(self.showMenu) +
            move((0, -110, 0), duration=2000))
        self.actionManager.do(dad,
                              action_rot + call(self.playMusic) + action_rot2)

        # varita
        self.actionManager.do(
            varita,
            repeat(
                random_delay(20000, 30000) + call(lambda: setattr(
                    varita, "translate",
                    Point3(random.randint(-400, 400), 600, 0))) +
                move((0, -1200, 0), duration=15000)))
        self.actionManager.do(varita, repeat(rotate(-360, duration=2000)))
Пример #37
0
 def __init__(self, ):
     Scene.__init__(self)
Пример #38
0
 def __init__(self, graph, *args, **kwargs):
     #See CubeGraph() above for format of graph
     self.graph = graph
     Scene.__init__(self, *args, **kwargs)
Пример #39
0
    def __init__(self, game):

        Scene.__init__(self, game)
        import sound

        self.root_node.background_color = view.CELESTE_CIELO
        am = self.actionManager = Manager()

        def enable(what):
            def doit():
                what.enable()

            return doit

        def disable(what):
            def doit():
                what.disable()

            return doit

        g1 = self.create_image("gift.png")
        g1.translate = Point3(200, -160, 0)

        g2 = self.create_image("gift.png")
        g2.translate = Point3(300, -160, 0)

        dad_hi = self.createDad()
        dad_hi.translate = Point3(250, -150, 0)

        dad = self.create_image("dad.gif")
        dad.translate = Point3(250, -150, 0)

        god = self.create_image("god.png")
        god.scale = (6, 2, 0)
        god.translate = Point3(-200, 145, 0)

        clouds = self.createClouds()
        clouds.translate = Point3(-540, 380, 0)
        clouds.scale = (3, 3, 0)
        clouds3 = self.createClouds2()
        clouds3.translate = Point3(-200, 300, 0)

        script = [
            ("- hi god!", 2000),
            (" nice to see", 2000),
            (" you are having fun", 2000),
            (" help me!", 2000),
            (" ", 3000),
            (" thanks!", 2000),
        ]

        offset = 0
        lines = []
        for line, duration in script:
            l = self.create_line(line)
            lines.append((l, offset, duration))
            offset += duration

        self.accept()
        [n.disable() for (n, a, x) in lines]
        dad_hi.disable()
        g1.disable()
        g2.disable()

        am.do(
            dad,
            delay(5000) + call(enable(dad_hi)) + call(disable(dad)) +
            delay(2000) + call(disable(dad_hi)) + call(enable(dad)) +
            delay(8000) + call(enable(g1)) + call(enable(g2)))

        for (line, start, duration) in lines:
            am.do(
                line,
                delay(5000) + delay(start) + call(enable(line)) +
                delay(duration) + call(disable(line)))
        def __init__(self):

            # Init the scene
            Scene.__init__(self, shared=shared)

            self.background_circle = dict({})
            self.circles = dict({})
            self.dummytex = dict({})

            self.dots_position = dict({})
            self.dots_x = dict({})
            self.dots_y = dict({})

            self.t_ = [0, 0, 0, 0]

            for fish_index in range(number_fish):

                self.background_circle[fish_index] = self.create_circles(
                    1, edges=30)
                self.background_circle[fish_index].reparentTo(
                    self.fish_nodes[fish_index])

                self.background_circle[fish_index].setScale(1, 0, 1)
                self.background_circle[fish_index].setColor(0, 0, 0)
                self.background_circle[fish_index].setPos(0, 0.001, 0)

                filepath = os.path.join(
                    os.path.split(__file__)[0], "circles.bam")
                self.circles[fish_index] = self.loader.loadModel(
                    Filename.fromOsSpecific(filepath))
                self.circles[fish_index].reparentTo(
                    self.fish_nodes[fish_index])

                self.dummytex[fish_index] = Texture("dummy texture")
                self.dummytex[fish_index].setup2dTexture(
                    10000, 1, Texture.T_float, Texture.FRgb32)
                self.dummytex[fish_index].setMagfilter(Texture.FTNearest)

                ts1 = TextureStage("part2")
                ts1.setSort(-100)

                self.circles[fish_index].setTexture(ts1,
                                                    self.dummytex[fish_index])
                self.circles[fish_index].setShader(self.compiled_shaders[0])

                self.dots_x[fish_index] = 2 * np.random.random(10000).astype(
                    np.float32) - 1
                self.dots_y[fish_index] = 2 * np.random.random(10000).astype(
                    np.float32) - 1

                self.dots_position[fish_index] = np.empty(
                    (1, 10000, 3)).astype(np.float32)
                self.dots_position[fish_index][0, :,
                                               0] = self.dots_x[fish_index]
                self.dots_position[fish_index][0, :,
                                               1] = self.dots_y[fish_index]
                self.dots_position[fish_index][0, :, 2] = np.random.randint(
                    0, 3, 10000
                ).astype(
                    np.float32
                ) * 0 + 1  # 0 will be black, 1, will be white, 2 will be hidden

                memoryview(self.dummytex[fish_index].modify_ram_image()
                           )[:] = self.dots_position[fish_index].tobytes()
Пример #41
0
 def __init__(self, caller, msg, img):
     Scene.__init__(self)
     self.msg = msg
     self.caller = caller
     self.img = SpriteNode(Texture(img))