def __init__(self): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.transarctica = director.core.query_mover("Transarctica") self._load_background() self._load_interface()
def __init__(self): Layer.__init__(self) menu = Menu("") menu_items = [] black_lyr = ColorLayer(0, 0, 0,0) self.add(black_lyr) black_lyr.width = int(director.window.width) black_lyr.height = int(director.window.height) black_lyr.position = (0, 0) black_lyr.opacity = 140 item = MenuItem('Continuar', self.on_quit) menu_items.append(item) menu.position = ( 0, -120) item.position = ( 0, 150) menu.font_title["font_name"] = "Tetrominoes" menu.font_title["color"] = (214, 178, 152, 255) menu.font_item["font_name"] = "Ravie" menu.font_item["font_size"] = 19 menu.font_item_selected["font_name"] = "Ravie" menu.font_item_selected["font_size"] = 22 menu.title = "PAUSADO" menu.create_menu( menu_items ) menu.on_quit = self.on_quit self.add(menu)
def __init__(self, back_team, front_team, location): """ :param back_team: :type back_team: team.Team :param front_team: :type front_team: team.Team :param location: :type location: str """ Layer.__init__(self) self.background_image = Sprite(pyglet.image.load( resource.load_resource("bg-" + location + ".jpg", "BattleBackgrounds")), position=(640/2, 480/2), scale=0.8) self.add(self.background_image) self.back_team = back_team self.front_team = front_team self.back_team.set_orientation(constants.BACK_FACING) self.front_team.set_orientation(constants.FRONT_FACING) self.back_team.add_to_battle(self) self.front_team.add_to_battle(self) self.add(self.front_team) self.add(self.back_team) self.animation_locked = False self.toggle_animation_lock = CallFunc(self._toggle_animation_lock) self.hud = BattleHUD(self) self.add(self.hud)
def __init__(self): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.schedule_interval(self.music_start, interval=7) self.intro_sound = load("music/sound_start.wav", streaming=False) self.intro_sound.play() self.is_event_handler = True background = Sprite(self.gallery.content["display"]["title"]) self.optimal_scale = ( self.config.window_width * self.display_pos_size["display_title"]["W"]) / background.width background.image_anchor = 0, 0 background.scale = self.optimal_scale background.x = self.config.window_width * self.display_pos_size[ "display_title"]["X"] background.y = self.config.window_height * self.display_pos_size[ "display_title"]["Y"] self.left_margin = background.x self.bottom_margin = background.y self.optimal_width = background.width self.optimal_height = background.height self.add(background) place_holder_image = Sprite(self.gallery.content["screen"]["title"]) place_holder_image.position = director.window.width / 2, director.window.height / 2 place_holder_image.scale = self.optimal_scale place_holder_image.do(ScaleBy(5.2, duration=25)) self.add(place_holder_image)
def __init__(self): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.sound_on_off = 'on' self._load_background() self._load_interface()
def __init__(self): Layer.__init__(self) self.anchor = Vector2() self.add( Sprite(image=pyglet.resource.image('background-tetris.png'), anchor=self.anchor)) # Background Image self.game_controller = game_controller.game_controller self.c_manager = self.game_controller.c_manager # obtem instancia do gerenciador de colisao tmp_block = Block(Vector2(), '') # para obter as dimencoes da imagem do bloco init_pos_x = 250 # meio eixo x da tela init_pos_y = tmp_block.height / 2 for i in range(23): blk = Block((init_pos_x - tmp_block.width, init_pos_y + (i * tmp_block.height)), block_color=BLOCK_WALL, b_type="Left_Wall") blk.anchor = (blk.width / 2, blk.height / 2) self.add(blk) blk = Block((init_pos_x + (tmp_block.width * 16), init_pos_y + (i * tmp_block.height)), block_color=BLOCK_WALL, b_type="Right_Wall") blk.anchor = (blk.width / 2, blk.height / 2) self.add(blk) #cria retangulo de colisao para paredes esquerda e direita self.c_manager.add( Collision_Rect(init_pos_x - tmp_block.width * 1.5, tmp_block.width, init_pos_y, 23 * tmp_block.height, b_type="Left_Wall")) self.c_manager.add( Collision_Rect(init_pos_x - tmp_block.width / 2 + (tmp_block.width * 16), tmp_block.width, init_pos_y, 23 * tmp_block.height, b_type="Right_Wall")) for i in range(16): blk = Block((init_pos_x + (i * tmp_block.width), init_pos_y), block_color=BLOCK_WALL, b_type="Base_Floor") blk.anchor = (blk.width / 2, blk.height / 2) self.add(blk) #cria retangulo de colisao para chao self.c_manager.add( Collision_Rect(init_pos_x - tmp_block.width / 2, 16 * tmp_block.width, init_pos_y - tmp_block.height / 2, tmp_block.height, b_type="Base_Floor"))
def __init__(self, wallpaper_image): """initializer""" Layer.__init__(self) self.is_event_handler = True wallpaper = Sprite( wallpaper_image, (director.window.width / 2, director.window.height / 2)) self.add(wallpaper)
def __init__(self): Layer.__init__(self) sheet = pyglet.image.load('img/tetris/walk.png') grid = pyglet.image.ImageGrid(sheet,2,8)[0:] grid = grid[8:] # reorder anim = pyglet.image.Animation.from_image_sequence(grid, .1, loop=True) spr = Sprite(anim) ; spr.position = W/2,H/2 self.add(spr)
def __init__(self, *pokemon): Layer.__init__(self) self.pokemon = list(pokemon) self.orientation = constants.NO_ORIENTATION self.remove_sprite = CallFuncS(self._remove_sprite) self.add_sprite = CallFuncS(self._add_sprite) self.current_battle = None """ :type: battle.DoubleBattleLayer"""
def __init__(self): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.transarctica = director.core.query_mover("Transarctica") self._load_background() self._load_interface() self.set_visibility(False) self.check_rumors()
def __init__(self): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.transarctica = director.core.query_mover("Transarctica") self._load_background() self._load_interface() self.switch_break() self.switch_direction() self.alarm_status = False
def __init__(self): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.transarctica = director.core.query_mover("Transarctica") self._load_background() self._load_interface() self.interact = False self.set_visibility(False) self.alarm_status = False
def __init__(self): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.transarctica = director.core.query_mover("Transarctica") self._load_background() self.service_mode = "NA" self.elements_to_remove = [] self._load_interface() self.set_visibility(True) self.TA = -1
def __init__(self): Layer.__init__(self) self.position = Vector2() # posicao fixa da layer self.anchor = Vector2() self.same_line_blks = { } # vai armazenar lista de blocos com mesma altura ( para remover quando completar a linha) self.game_controller = game_controller.game_controller self.c_manager = self.game_controller.c_manager # obtem instancia do gerenciador de colisao
def __init__(self): Layer.__init__(self) self.position = Vector2() ## posicao fixa da layer self.anchor = Vector2() self.score_label = Label( "0", position=(880, 350), font_name="Ravie", align="center", anchor_x="center") # texto onde mostra o score atual self.add(self.score_label) self.pause_label = Label("( ESC )", position=(820, 190), font_name="Ravie", align="center", anchor_x="center") self.add(self.pause_label) self.pause_label = Label("Sair", position=(885, 190), font_name="Ravie", align="center", anchor_x="center", color=(214, 178, 152, 255)) self.add(self.pause_label) self.pause_label = Label("( P )", position=(820, 210), font_name="Ravie", align="center", anchor_x="center") self.add(self.pause_label) self.pause_label = Label(" Pause", position=(880, 210), font_name="Ravie", align="center", anchor_x="center", color=(214, 178, 152, 255)) self.add(self.pause_label) self.time_label = Label( "00:00", position=(880, 250), font_name="Ravie", align="center", anchor_x="center") # texto onde mostra o score atual self.add(self.time_label) self.next_piece = Piece(POS_NX_PIECE)
def __init__(self, lap_count): Layer.__init__(self) self.lap_count = lap_count self.laps_label = util.Label(text=self.get_laps_text(1), font_size=25, background=(0, 0, 0, 125), anchor_y='bottom') self.laps_label.y = director.window.height - self.laps_label.height self.add(self.laps_label)
def __init__(self, battle): """ :param battle: :type battle: battle.DoubleBattleLayer """ Layer.__init__(self) self.battle = battle self.back_left_health = None self.back_right_health = None self.front_left_health = None self.front_right_health = None self.update_health_bars()
def __init__(self, market): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.transarctica = director.core.query_mover("Transarctica") self.wagons_for_trade = {} self.wagons_for_dump = {} self.message="" self.trade_display = True self.market=market self.generate_wagons_for_trade() self.generate_wagons_for_dump() self._load_background() self._load_interface() self.set_visibility(False)
def __init__(self, side="left", background_color=(0, 0, 0, 0), expand="fit"): """initializer""" Layer.__init__(self) self._borders = {"left": 0, "right": 0, "top": 0, "bottom": 0} self._margins = {"left": 0, "right": 0, "top": 0, "bottom": 0} self._padding = {"left": 0, "right": 0, "top": 0, "bottom": 0} self._check_arguments(expand, side) self.side = side self.expand = expand self.background_color = background_color self.width = 0 self.height = 0 self.add(ColorLayer(*background_color, width=0, height=0), name="background")
def __init__(self, supply, market): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.transarctica = director.core.query_mover("Transarctica") self.items_for_trade = {} self.items_for_dump = {} self.message = "" self.trade_display = True #if (supply=="hub") and (market=="commerce"): # self.market=supply #else: self.market = market self.supply = supply self.generate_items_for_trade(supply) self.generate_items_for_dump() self._load_background() self._load_interface() self.set_visibility(False)
def __init__(self, is_game_over=False): Layer.__init__(self) self.position = Vector2() self.anchor = Vector2() self.fs = file_saver.File_Saver( "rankings.txt") #nome para o arquivo de ranking self.rank_dict = {} menu = Menu("") menu_items = [] item = MenuItem('Voltar', self.on_quit) menu_items.append(item) item.position = (0, -210) if (is_game_over): menu.title = "GAME OVER" black_lyr = ColorLayer(0, 0, 0, 0) self.add(black_lyr) black_lyr.width = int(director.window.width) black_lyr.height = int(director.window.height) black_lyr.position = (0, 0) black_lyr.opacity = 120 input_item = EntryMenuItem('Insira o nome:', self.on_text, "", 6) menu_items.append(input_item) input_item.position = (0, -90) else: menu.title = "RANKING" menu.font_title["font_name"] = "Tetrominoes" menu.font_title["color"] = (214, 178, 152, 255) menu.font_item["font_name"] = "Ravie" menu.font_item["font_size"] = 19 menu.font_item_selected["font_name"] = "Ravie" menu.font_item_selected["font_size"] = 22 menu.create_menu(menu_items) menu.on_quit = self.on_quit self.add(menu)
def __init__(self, module, filepath): Layer.__init__(self) self.module = module self.filepath = filepath self.paths = [] self.pathp = 0 self.near = None for name in dir(module): what = getattr(module, name) if isinstance(what, Bezier): p = PathView(name, what) self.paths.append(p) if len(self.paths) == 0: self.new_path() self.state = self.SHOW self.stop = False self.mouse = Point(0, 0) self.font = font.load("Arial", 18) self.duration = 3 self.time_warp = 1 self.number = ""
def __init__(self, module, filepath): Layer.__init__(self) self.module = module self.filepath = filepath self.paths = [] self.pathp = 0 self.near = None for name in dir(module): what = getattr(module, name) if isinstance(what, Bezier): p = PathView(name, what) self.paths.append(p) if len(self.paths) == 0: self.new_path() self.state = self.SHOW self.stop = False self.mouse = Point(0, 0) self.font = font.load('Arial', 18) self.duration = 3 self.time_warp = 1 self.number = ""
def __init__(self, player, width, height): Layer.__init__(self) self.width = width self.height = height self.player = player.domain msg = Label( 'health %s, sticks: %s' % (self.player.health, self.player._inventory.get('sticks')), font_name='somebitch', anchor_x='left', anchor_y='bottom', # really - it's top of screen width=width, height=25, x=5, y=-3, ) color = (73, 106, 44, 255) hudBackground = ColorLayer(*color, width=self.width, height=25) hudBackground.position = (0, 0) self.add(hudBackground) self.add(msg, name='msg') self.schedule(self.update)
def __init__(self): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self.wind = Player() source = load("music/sound_start.wav") self.wind.queue(source) self.wind.volume = 0.3 self.wind.play() self.background = Sprite(self.gallery.content["display"]["title"]) self.optimal_scale = (self.config.window_width * self.display_pos_size["display_title"]["W"] ) / self.background.width self.background.image_anchor = 0, 0 self.background.scale = self.optimal_scale self.background.x = self.config.window_width * self.display_pos_size[ "display_title"]["X"] self.background.y = self.config.window_height * self.display_pos_size[ "display_title"]["Y"] self.left_margin = self.background.x self.bottom_margin = self.background.y self.optimal_width = self.background.width self.optimal_height = self.background.height place_holder_image = Sprite(self.gallery.content["screen"]["title"]) place_holder_image.position = director.window.width / 2, director.window.height / 2 #place_holder_image.scale=self.optimal_scale/30 #place_holder_image.do(ScaleBy(45, duration=35)) place_holder_image.scale = self.optimal_scale self.add(place_holder_image) self.background2 = self.background self.add(self.background) self.add(self.background2) self.schedule_interval(self.intro_train_start, interval=5) self.schedule_interval(self.intro_music_start, interval=4) self.is_event_handler = True
def __init__(self): Layer.__init__(self) self.image = pyglet.resource.image('background.png')
def __init__(self, klass): Layer.__init__(self) self.add(ColorLayer(0, 0, 0, 100), z=0) self.add(klass(), z=1)
def __init__(self, game): Layer.__init__(self) self.game = game
def __init__(self): Layer.__init__(self) image = pyglet.resource.image(resconfig.battle_ground_1) self.backgound = Sprite(image, position=(image.width/2, image.height/2))
def __init__(self): Layer.__init__(self) self.players = {} self.action = None
def __init__(self): Layer.__init__(self) label = cocos.text.Label("Hell Cocos", font_size=H / 2 / 5, anchor_x='center', anchor_y='top') label.position = W / 2, H-5 self.add(label)
def __init__(self, opt, bubble_type, px, py, pscale): Layer.__init__(self) self.config = Config() self.gallery = Gallery() self._load_background(bubble_type, px, py, pscale) self._load_interface(opt)