예제 #1
0
    def level_start(self):
        start_animation_frames = 100
        start_animation_time = start_animation_frames

        while not self.world.quit:
            if start_animation_time == 0:
                break

            self.world.update()
            if self.world.spawn:
                asteroid.Asteroid(self.world, 
                                  random.randint(75, 100), 
                                  self.level)

            self.surface.fill(util.BLACK)
            self.draw_hud()
            self.draw_info()
            start_animation_time -= 1
            t = float(start_animation_time) / start_animation_frames
            text.draw_string(self.surface, "LEVEL START", util.WHITE,
                             t * 150,
                             [self.width / 2, self.height / 2],
                             centre = True, 
                             angle = t * 200.0)
            self.world.draw()
            self.clock.tick(60)
            pygame.display.flip()
예제 #2
0
    def level_start(self):
        start_animation_frames = 100
        start_animation_time = start_animation_frames

        while not self.world.quit:
            if start_animation_time == 0:
                break

            self.world.update()
            if self.world.spawn:
                asteroid.Asteroid(self.world, 
                                  random.randint(75, 100), 
                                  self.level)

            self.surface.fill(util.BLACK)
            self.draw_hud()
            self.draw_info()
            start_animation_time -= 1
            t = float(start_animation_time) / start_animation_frames
            text.draw_string(self.surface, "LEVEL START", util.WHITE,
                             t * 150,
                             [self.width / 2, self.height / 2],
                             centre = True, 
                             angle = t * 200.0)
            self.world.draw()
            self.clock.tick(60)
            pygame.display.flip()
            self.video.capture()
예제 #3
0
    def game_over(self):
        end_animation_frames = 100
        end_animation_time = end_animation_frames

        while not self.world.quit:
            if end_animation_time == 0:
                break

            self.world.update()

            self.surface.fill(util.BLACK)
            self.draw_hud()
            self.draw_info()
            end_animation_time -= 1
            t = float(end_animation_time) / end_animation_frames
            text.draw_string(self.surface,
                             "GAME OVER",
                             util.WHITE,
                             math.log(t + 0.001) * 150,
                             [self.width / 2, self.height / 2],
                             centre=True,
                             angle=180)
            self.world.draw()
            self.clock.tick(60)
            pygame.display.flip()
예제 #4
0
    def epilogue(self):
        while not self.world.quit:
            if self.world.enter:
                break

            self.world.update()

            self.surface.fill(util.BLACK)
            text.draw_string(self.surface, "PRESS ENTER TO PLAY AGAIN", 
                             util.WHITE,
                             20,
                             [self.width / 2, self.height / 2],
                             centre = True,
                             angle = 0)
            self.draw_hud()
            self.draw_info()
            self.world.draw()
            self.clock.tick(60)
            pygame.display.flip()
예제 #5
0
    def epilogue(self):
        while not self.world.quit:
            if self.world.enter:
                break

            self.world.update()

            self.surface.fill(util.BLACK)
            text.draw_string(self.surface, "PRESS ENTER TO PLAY AGAIN", 
                             util.WHITE,
                             20,
                             [self.width / 2, self.height / 2],
                             centre = True,
                             angle = 0)
            self.draw_hud()
            self.draw_info()
            self.world.draw()
            self.clock.tick(60)
            pygame.display.flip()
예제 #6
0
    def game_over(self):
        end_animation_frames = 100
        end_animation_time = end_animation_frames

        while not self.world.quit:
            if end_animation_time == 0:
                break

            self.world.update()

            self.surface.fill(util.BLACK)
            self.draw_hud()
            self.draw_info()
            end_animation_time -= 1
            t = float(end_animation_time) / end_animation_frames
            text.draw_string(self.surface, "GAME OVER", util.WHITE,
                             math.log(t + 0.001) * 150,
                             [self.width / 2, self.height / 2],
                             centre = True,
                             angle = 180)
            self.world.draw()
            self.clock.tick(60)
            pygame.display.flip()
예제 #7
0
 def draw_info(self):
     if self.world.info:
         text.draw_string(self.surface, 
                          "FPS %d" % self.clock.get_fps(),
                          util.WHITE, 10, [10, self.height - 20])
         text.draw_string(self.surface, 
                          "OBJECTS %d" % self.world.n_objects(), 
                          util.WHITE, 10, [10, self.height - 40])
         text.draw_string(self.surface, 
                          "PARTICLES %d" % self.world.particle.n_particles(),
                          util.WHITE, 10, [10, self.height - 60])
예제 #8
0
 def draw_info(self):
     if self.world.info:
         text.draw_string(self.surface, 
                          "FPS %d" % self.clock.get_fps(),
                          util.WHITE, 10, [10, self.height - 20])
         text.draw_string(self.surface, 
                          "OBJECTS %d" % self.world.n_objects(), 
                          util.WHITE, 10, [10, self.height - 40])
         text.draw_string(self.surface, 
                          "PARTICLES %d" % self.world.particle.n_particles(),
                          util.WHITE, 10, [10, self.height - 60])
예제 #9
0
 def draw_hud(self):
     text.draw_string(self.surface, "SCORE %d" % self.world.score, 
                      util.WHITE, 10, [10, 20])
     text.draw_string(self.surface, "LEVEL %d" % self.level, 
                      util.WHITE, 10, [10, 40])
예제 #10
0
 def draw_hud(self):
     text.draw_string(self.surface, "SCORE %d" % self.world.score, 
                      util.WHITE, 10, [10, 20])
     text.draw_string(self.surface, "LEVEL %d" % self.level, 
                      util.WHITE, 10, [10, 40])