예제 #1
0
class ScenePlay(SceneBase):
    def __init__(self, game_manager):
        SceneBase.__init__(self, game_manager)
        self.fragments = Fragments()
        self.fragments.shuffle()
        self.move_counter = MoveCounter((SCREEN_OFFSET, 20))
        self.game_timer = GameTimer((200 + SCREEN_OFFSET, 20))
        self.playing = True

    def update(self, filtered_events, pressed_keys):
        if self.playing:
            self.game_timer.update()
            if self.fragments.update(filtered_events, pressed_keys):
                self.move_counter.add_count()
            if self.fragments.gameclear():
                self.fragments.set_blank(False)
                self.playing = False
                self.game_manager.change_scene(SceneGameClear(self.game_manager, self))

    def draw(self, screen):
        self.fragments.draw(screen)
        self.move_counter.draw(screen)
        self.game_timer.draw(screen)
        self.draw_line(screen)

    def draw_line(self, screen):
        for i in xrange(5):
            pygame.draw.line(screen, (255,255,255), (i * 120 + SCREEN_OFFSET, SCREEN_OFFSET), (i * 120 + SCREEN_OFFSET, 320 + SCREEN_OFFSET))
            pygame.draw.line(screen, (255,255,255), (0 + SCREEN_OFFSET, i * 80 + SCREEN_OFFSET), (480 + SCREEN_OFFSET, i * 80 + SCREEN_OFFSET))
예제 #2
0
 def __init__(self, game_manager):
     SceneBase.__init__(self, game_manager)
     self.fragments = Fragments()
     self.fragments.shuffle()
     self.move_counter = MoveCounter((SCREEN_OFFSET, 20))
     self.game_timer = GameTimer((200 + SCREEN_OFFSET, 20))
     self.playing = True