Example #1
0
 def __init__(self,nivel):
     self.timer = pygame.time.Clock()
     self.display = pygame.display.get_surface()
     self.nivel = nivel
     print("el nivel del juego es")
     print (self.nivel)
     if self.nivel == 1:
         self.level_manager = state.StateMachine(self, level.Level())
     else:
         self.level_manager = state.StateMachine(self, level.Level_Escuela())
     self.player = player.Player(self.nivel)
     Game.player = self.player
     self.background = pygame.image.load("data/images/paisaje.jpg").convert_alpha()
     surface_manager.add(self.player)
     self.music = pygame.mixer.Sound("data/sound/game.wav")
     self.music.play(loops=-1)
     self.perdio=pygame.mixer.Sound("data/sound/perdiste.wav")
     self.instruc = pygame.mixer.Sound("data/sound/instruccionesjuego.wav")
     self.p_vez1 = False
     self.p_vez2 = False
     if self.nivel == 1:
         self.p_vez1 = True
     else:
         self.p_vez2 = True
     self.display.blit(self.background, (0, 0))
     pygame.display.flip()
Example #2
0
 def __init__(self):
     self.timer = pygame.time.Clock()
     self.display = pygame.display.get_surface()
     self.level_manager = state.StateMachine(self, level.Level())
     self.player = player.Player()
     Game.player = self.player
     self.hud_manager = state.StateMachine(self, hud.Hud(self, self.player, self.timer))
     self.background = pygame.image.load("data/images/city.png").convert_alpha()
     surface_manager.add(self.player)
     self.music = pygame.mixer.Sound("data/sound/game.wav")
     self.music.play(loops=-1)
Example #3
0
    def act(self):
        self.check_platforms()

        if (len(self.current_platforms) < self.num_of_platforms) \
                and ((self.current_platforms[-1].pos_x + self.current_platforms[-1].rect.width) <= (self.display.get_width() - random.randint(100, 600))):
            new_platform = platform.Platform("data/images/platform.png")
            surface_manager.add(new_platform)
            self.current_platforms.append(new_platform)

        if time.clock() >= self.time_since_last_orbspawn + .5:
            surface_manager.add(orb.Orb())
            self.time_since_last_orbspawn = time.clock()
Example #4
0
 def __init__(self):
     self.timer = pygame.time.Clock()
     self.display = pygame.display.get_surface()
     self.current_platforms = []
     self.num_of_platforms = 4
     self.background = load_image(getLevelImage())
     self.display.blit(self.background, (0, 0))
     ## create the starting platform
     new_platform = platform.Platform(getLevelPlatformImage(),True)
     surface_manager.add(new_platform)
     self.current_platforms.append(new_platform)
     self.time_since_last_powerup = time.clock()
     self.time_since_last_enemyspawn = time.clock()
     self.bonus = None
Example #5
0
 def __init__(self):
     self.timer = pygame.time.Clock()
     self.display = pygame.display.get_surface()
     displayWidth = self.display.get_width()
     displayHeight = self.display.get_height()
     self.player = player.Player()
     Game.player = self.player
     self.level_manager = state.StateMachine(self,level.Level())
     self.hud_manager = state.StateMachine(self, hud.Hud(self, self.player, self.timer))
     self.background = load_image(getGameBackground())
     self.background = pygame.transform.scale(self.background,(displayWidth,displayHeight))
     surface_manager.add(self.player)
     self.player.startGame()
     self.music = load_sound(getGameSound())
     self.music.play(loops=-1)
Example #6
0
    def act(self):
        if game.Game.score == 0:
            self.nivel = 1
        elif game.Game.score > 0 and game.Game.score <=3:
            self.nivel = 1
        elif game.Game.score > 3 and game.Game.score <=6 and self.instr2_Rep:
            self.nivel= 2
            self.instr2.play()
            pygame.time.delay(int(self.instr2.get_length()*1000))
            self.instr2_Rep = False
            self.instr3_Rep = True
        elif game.Game.score > 6 and self.instr3_Rep:
                self.nivel=3
                self.instr3.play()
                pygame.time.delay(int(self.instr3.get_length()*1000))
                self.instr3_Rep = False
        
        print(game.Game.score)
        print(self.nivel)
        self.check_platforms()

        if (len(self.current_platforms) < self.num_of_platforms) \
                and ((self.current_platforms[-1].pos_x + self.current_platforms[-1].rect.width) <= (self.display.get_width() - random.randint(100, 600))):
            new_platform = plataforma.Plataforma("data/images/platform.png",self.nivel)
            surface_manager.add(new_platform)
            self.current_platforms.append(new_platform)


        if time.clock() >= self.time_since_last_enemyspawn + .60:
            surface_manager.add(enemigo.Enemigo())
            self.time_since_last_enemyspawn = time.clock()
        
        if time.clock() >= self.time_since_last_sadspawn + .90:
            surface_manager.add(happy_face.Happy())
            self.time_since_last_sadspawn = time.clock()
Example #7
0
    def act(self):
        self.timer.tick(60)
        self.check_platforms()

        keys = pygame.key.get_pressed()
        if keys[K_LEFT]:
            self.movePlatformsLeft()
            if self.bonus != None:
                self.moveShirukenPULeft()
        elif keys[K_RIGHT]:
            self.movePlatformsRight()
            if self.bonus != None:
                self.moveShirukenPURight()
                

        ## we can choose the distance between the number of platforms
        if self.weShouldAddPlatform():
            new_platform = platform.Platform(getLevelPlatformImage())
            surface_manager.add(new_platform)
            self.current_platforms.append(new_platform)
       
        if self.weShouldAddPowerUp():
            self.bonus = powerup.ShurikenPU()
            surface_manager.add(self.bonus)
            self.time_since_last_powerup = time.clock()

        if self.weShouldAddEnemy():
            self.ennemies = enemy.Enemy()
            surface_manager.add(self.ennemies)
            self.time_since_last_enemyspawn = time.clock()
Example #8
0
 def act(self):
     if not self.esc_cargado:
         for lista_p in self.lista:
             new_platform = plataforma.EscuelaPlatform("data/images/plataforma_2.png",lista_p)
             surface_manager.add(new_platform)
             enemigos_L2 = enemigo.Enemy_L2(lista_p)
             surface_manager.add(enemigos_L2)
             
         for lista_c in self.lista_caritas:
             carita_L2 = happy_face.Happy_L2(lista_c)
             surface_manager.add(carita_L2)
             
         self.esc_cargado = True
Example #9
0
    def __init__(self, game, player, timer):
        self.display = pygame.display.get_surface()

        Hud.player = player
        Hud.timer = timer
        Hud.game = game
        #Applies the custom font
        self.font_manager = pygame.font.Font("data/fonts/coders_crux.ttf", 28)
        self.bullet_element = BulletElement(self.font_manager)
        self.fps_element = FPSElement(self.font_manager)
        self.score_element = ScoreElement(self.font_manager)
        #Adds the bullet, score, and fps information to the HUD
        surface_manager.add(self.bullet_element)
        surface_manager.add(self.fps_element)
        surface_manager.add(self.score_element)
Example #10
0
	def __init__(self, game, player, timer):
		self.display = pygame.display.get_surface()

		Hud.player = player
		Hud.timer = timer
		Hud.game = game

		self.font_manager = load_font(getHudFont(),getHudFontSize())

		self.shuriken_element = ShurikenElement(self.font_manager)
		self.fps_element = FPSElement(self.font_manager)
		self.score_element = ScoreElement(self.font_manager)

		surface_manager.add(self.shuriken_element)
		surface_manager.add(self.fps_element)
		surface_manager.add(self.score_element)
Example #11
0
    def __init__(self, game, player, timer):
        self.display = pygame.display.get_surface()

        Hud.player = player
        Hud.timer = timer
        Hud.game = game

        self.font_manager = pygame.font.Font("data/fonts/SEVEMFBR.TTF", 28)

        self.shuriken_element = ShurikenElement(self.font_manager)
        self.fps_element = FPSElement(self.font_manager)
        self.score_element = ScoreElement(self.font_manager)

        surface_manager.add(self.shuriken_element)
        surface_manager.add(self.fps_element)
        surface_manager.add(self.score_element)
Example #12
0
 def throw_shuriken(self):
     if self.shurikens > 0:
         self.throw_sound.play()
         surface_manager.add(projectile.Projectile(self))
         self.shurikens -= 1
Example #13
0
 def enter(self):
     new_platform = plataforma.StartingPlatform("data/images/platform.png",self.nivel)
     surface_manager.add(new_platform)
     self.current_platforms.append(new_platform)
     self.time_since_last_enemyspawn = time.clock()
     self.time_since_last_sadspawn = time.clock()
Example #14
0
 def shoot(self):
     if self.bullets > 0:
         surface_manager.add(projectile.Projectile(self))
         self.bullets -= 1
Example #15
0
def show_combo(bonus):
    surface_manager.add(ComboElement(bonus))
Example #16
0
 def throw_shuriken(self):
     if self.shurikens > 0:
         self.throw_sound.play()
         surface_manager.add(arma.Arma(self))
         self.shurikens -= 1
Example #17
0
 def enter(self):
     new_platform = platform.StartingPlatform("data/images/platform.png")
     surface_manager.add(new_platform)
     self.current_platforms.append(new_platform)
     self.time_since_last_orbspawn = time.clock()