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)
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)
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()
def get_size(self): return size_cfg.get('bars').get('metal-bar').get('x'), size_cfg.get( 'bars').get('metal-bar').get('y')
def get_size(self): return size_cfg.get('bars').get('earth-bar').get('x'), size_cfg.get( 'bars').get('earth-bar').get('y')
def get_size(self): return size_cfg.get('bars').get('basic').get('x'), size_cfg.get( 'bars').get('basic').get('y')
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')
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')