Ejemplo n.º 1
0
 def __init__(self, lvl=2):
     sparkle_name = img_cfg.get('background').get('sparkle-basic')
     width = size_cfg.get('background').get('sparkle-basic').get('x')
     height = size_cfg.get('background').get('sparkle-basic').get('y')
     BackgroundObject.__init__(self,
                               sparkle_name,
                               width,
                               height,
                               lvl,
                               colorkey=-1)
Ejemplo n.º 2
0
 def __init__(self, lvl=2):
     life_icon_name = img_cfg.get('background').get('life-icon-2')
     width = size_cfg.get('background').get('life-icon-2').get('x')
     height = size_cfg.get('background').get('life-icon-2').get('y')
     BackgroundObject.__init__(self,
                               life_icon_name,
                               width,
                               height,
                               lvl,
                               moving=False,
                               colorkey=-1)
Ejemplo n.º 3
0
def main():
    pygame.init()
    res_x = size_cfg.get('resolution').get('x')
    res_y = size_cfg.get('resolution').get('y')
    screen = pygame.display.set_mode((res_x, res_y))

    scene = MetalScene(screen)

    pygame.display.flip()
    judge = Judge(scene)
    clock = pygame.time.Clock()

    while 1:
        clock.tick(60)

        for event in pygame.event.get():
            if event.type == QUIT:
                return
            elif event.type == KEYDOWN and event.key == K_ESCAPE:
                return
            elif event.type == KEYDOWN:
                if event.key == K_LEFT:
                    scene.bar.move_left()
                elif event.key == K_RIGHT:
                    scene.bar.move_right()
                elif event.key == K_SPACE:
                    if judge.scene.ball.on_bar:
                        judge.start_ball()
            elif event.type == KEYUP:
                if event.key == K_RIGHT or event.key == K_LEFT:
                    scene.bar.move_pos = [0, 0]
                    scene.bar.state = "still"

        pygame.event.pump()

        if judge.check_point_lost():
            judge.recover_ball()
        if judge.check_game_lost():
            # TODO to implement
            return
        if judge.check_game_won():
            return

        scene.update_scene()
        scene.draw_scene()
Ejemplo n.º 4
0
 def get_size(self):
     return size_cfg.get('bars').get('metal-bar').get('x'), size_cfg.get(
         'bars').get('metal-bar').get('y')
Ejemplo n.º 5
0
 def get_size(self):
     return size_cfg.get('bars').get('earth-bar').get('x'), size_cfg.get(
         'bars').get('earth-bar').get('y')
Ejemplo n.º 6
0
 def get_size(self):
     return size_cfg.get('bars').get('basic').get('x'), size_cfg.get(
         'bars').get('basic').get('y')
Ejemplo n.º 7
0
 def get_size(self):
     return size_cfg.get('tiles').get('metal-tile-3').get(
         'x'), size_cfg.get('tiles').get('metal-tile-3').get('y')
Ejemplo n.º 8
0
 def get_size(self):
     return size_cfg.get('tiles').get('earth-tile-2').get(
         'x'), size_cfg.get('tiles').get('earth-tile-2').get('y')