def __init__(self, bounds): Group.__init__(self) self.bounds = bounds self.spawn_rate = COIN_SPAWN_RATE * 1000 self.spawn_timer = 0
def __init__(self, manager: UIManager, x_pos: int, y_pos: int, color: Tuple[int, int, int], width: int, height: int, text='Test Button', disable=False, font_size=15, padding=PADDING): Group.__init__(self) UIComponent.__init__(self, manager) self.color = color self.x_pos = x_pos self.y_pos = y_pos self.width = width self.height = height self.text = text self.disable = disable self.font_size = font_size self.padding = padding self.color = color self.button = Sprite() self.button.image = Surface([width, height]) self.button.image.fill(color) render_inline_text(self.button.image, self.text, self.font_size, (0, 0, 0)) self.button.rect = self.button.image.get_rect() self.button.rect.topleft = (x_pos, y_pos) self.add(self.button)
def __init__(self, menuItemSet): self.visible = False self.maxX = 0 self.maxY = 0 Group.__init__(self) self.title = self.titleSprite() self.add(self.title) self.maxY += 48 + 5 self.active = None self.bgColor = (8, 24, 34, 224) self.borderColor = (32, 96, 192) # hilight - hotkey - normal - disabled self.menuItemColors = (128, 192, 255), (24, 128, 255), (192, ) * 3, (64, ) * 3 self.enterSurface = None self.offsetOnSurface = (0, 0) self.orderList = [] self.generate(menuItemSet) self.redraw() self.clearBg = Surface(self.bg.get_size()) self.getFirst() self.selectorSprite(self, False) self.selectorSprite(self, True)
def __init__(self, moving_sprite, speedx = 0, maxspeedx = -1, speedy = 0, maxspeedy = -1, posx = 0, posy = 0, thrust_strength = 0, accelx = 0, accely = 0, gravity = 1000, decrease_speed_ratio = 2.0): Group.__init__(self) self.moving_sprite = moving_sprite self.speedx = speedx self.speedy = speedy self.maxspeedx = maxspeedx self.maxspeedy = maxspeedy self.posx = posx self.posy = posy self.thrust_strength = thrust_strength self.accelx = accelx self.accely = accely self.gravity = gravity self.decrease_speed_ratio = decrease_speed_ratio self.bumping_walls = []
def __init__(self, sizex, sizey, wx=0, wy=0): Group.__init__(self) self.wx = wx self.wy = wy self.sizex = sizex self.sizey = sizey self.scripts = []
def __init__(self, manager: UIManager, x_pos: int, y_pos: int, width: int, height: int, options: List[str], background: Tuple[int, int, int] = (255, 255, 255), text_size: int = 20, text_color: Tuple[int, int, int] = (0, 0, 0)): if len(options) == 0: raise Exception("There must be one or more options") UIComponent.__init__(self, manager) Group.__init__(self) self.x_pos = x_pos self.y_pos = y_pos self.width = width self.height = height self.options = options self.background = background self.text_size = text_size self.text_color = text_color self.menu_open = False self.value = self.options[0] self.close()
def __init__(self, col, gr): Group.__init__(self) self.sprite_group = Group() self.Collision = [] self.collevel = col self.grlevel = gr self.level_width = 0 self.level_height = 0
def __init__(self, window): Group.__init__(self) GameConfigure.__init__(self) self.window = window for i in range(self.numStars): newStar = Star(window) self.add(newStar) pass pass
def __init__(self, map, imageCache, rectPixelView, imWidth, imHeight): Group.__init__(self) self._changeListeners = [] self.map = map self.worldRect = Rect(0, 0, self.map.width * imWidth, self.map.height * imHeight) self.imageCache = imageCache self.imageSize = (imWidth, imHeight) self.offsetX = 0 self.offsetY = 0 self.setView(rectPixelView)
def __init__(self, agsettings): Group.__init__(self) self.agsettings = agsettings # Group settings self.size = self.agsettings.aliengroup_size # Movement flags self.ymove = self.agsettings.v_d * self.agsettings.alien_speed self.xmove = self.agsettings.h_d * self.agsettings.alien_speed
def __init__(self, bounds): Group.__init__(self) self.bounds = bounds.copy() # adjust bounds to compensate for coin size coin_img = load_image("coin") spritesheet = SpriteSheet(coin_img, (8, 1)) self.bounds.width -= spritesheet.width self.bounds.height -= spritesheet.height
def __init__(self): Group.__init__(self) self.x = 0 self.y = 0 self.upper_box = Rect(0, 0, 1000, 150) self.lower_box = Rect(0, 650, 1000, 150) self.left_box = Rect(0, 0, 150, 800) self.right_box = Rect(850, 0, 150, 800) self.camera_speed = 5
def __init__(self, map, imageCache, rectPixelView, imWidth, imHeight): Group.__init__(self) self._changeListeners = [] self.upperLeft = [0, 0] self.numTiles = (int(rectPixelView.width / imWidth), int(rectPixelView.height / imHeight)) self.map = map self.imageCache = imageCache self.imageSize = (imWidth, imHeight) self.offsetX = 0 self.offsetY = 0 self.setView(rectPixelView)
def __init__(self, game): Group.__init__(self) self.game = game self.need_draw = True self.key_test_period = 0.25 self.__tick = 0 self.rom_executor = RomExecutor() self.game_list = RomDataItemsConstructor( game.app.config.get("PATHS", "gamelist")) self.sdcard_constructor = DirlistItemConstructor( game.app.config.get("PATHS", "sdcard"), Executor()) self.all_constructors = [ BaseItemConstructor(), # for favorites self.game_list.getConsole("GEN"), # for gen self.game_list.getConsole("SMS"), # for sms self.game_list.getConsole("NES"), # for nes self.game_list.getConsole("SNES"), # for snes self.sdcard_constructor, None ] self.item_constructor = self.all_constructors[0] self.bg = Background(game) self.title_text = TextSprite("", game.assets["TITLE_FONT"]) self.update_title_text(self.game.assets["ICONS"][0]['title']) self.title_text.centered = True self.platform = MainMenuPlatformList(game) self.file_list = FileList(game, self.item_constructor) self.file_list.deselect_all() self.selector_state = MainStage.SELECTRO_ICONS #self.add(*[self.bg, self.title_text, self.platform, self.file_list]) game.app.input.addEvent(input.Input.EVENT_DOWN, self.nextItem) game.app.input.addEvent(input.Input.EVENT_UP, self.lastItem) game.app.input.addEvent(input.Input.EVENT_NEXT, self.select) game.app.input.addEvent(input.Input.EVENT_BACK, self.selectBack) game.app.input.addEvent(input.Input.EVENT_LEFT, self.last10Item_list) game.app.input.addEvent(input.Input.EVENT_RIGHT, self.next10Item_list) self.parts = [self.title_text, self.platform, self.file_list]
def __init__(self): Group.__init__(self) color = FIRST_COLOR_CELL for y in range(0, 512, CELLS_SIZE): if color == FIRST_COLOR_CELL: color = SECOND_COLOR_CELL else: color = FIRST_COLOR_CELL for x in range(0, 512, CELLS_SIZE): self.add(Cell(color, (x, y))) if color == FIRST_COLOR_CELL: color = SECOND_COLOR_CELL else: color = FIRST_COLOR_CELL
def __init__(self, game): Group.__init__(self) self.need_draw = True self.__selected = 0 self.game = game self.slide_time = 0.1 self.target_selector_pos = [0, 0] self.selector = Sprite(pygame.image.load( game.assets["SELECTOR"]).convert_alpha()) self.createButtons() self.add(self.selector) self.add(*self.buttons) self.last_rect = pygame.Rect(0,0,0,0) self.selected = 0
def __init__(self, columns, rows): Group.__init__(self) self.enemies: List[List[Optional[Enemy]]] = [[None] * columns for _ in range(rows)] self.columns = columns self.rows = rows self.left_add_move = 0 self.rightAddMove = 0 self.move_time = ENEMY_MOVE_TIME self.direction = 1 self.right_moves = 30 self.left_moves = 30 self.move_number = 15 self.timer = self.move_time self._alive_columns = list(range(columns)) self._left_alive_column = 0 self._right_alive_column = columns - 1 self._left_killed_columns = 0 self._right_killed_columns = 0 self.speed_listener = None
def __init__(self): Group.__init__(self) BaseModel.__init__(self) # load image _money_image = pygame.image.load( get_file_path('img/item/money.png')).convert_alpha() _subsurface_data = [(25, 24), (25, 24), (33, 30), (32, 31)] _y = 0 self.money_images = [] for _sub_data in _subsurface_data: _tmp_list = [_money_image.subsurface( (i*_sub_data[0], _y), _sub_data) for i in range(4)] _y += _sub_data[1] self.money_images.append(_tmp_list) _item_rare_image = pygame.image.load( get_file_path('img/item/rare_42x44.png')).convert_alpha() self.item_rare_images = [_item_rare_image.subsurface( (i*ITEM_RARE_SIZE[0], 0), ITEM_RARE_SIZE) for i in range(6)] # load icons, but now only load one image self.item_icons = pygame.image.load( get_file_path('img/item/04000019.png')).convert_alpha()
def __init__(self, target, sprite_filename, formation, target_position): Group.__init__(self) self.target = target self.sprite_filename = sprite_filename self.target_position = target_position #this image is passed to each Cell object cell_image = pygame.image.load(sprite_filename).convert_alpha() #convert formation list into table of cell sprites #offsets are the difference between current cell and target cell #since first cell is (0, 0) these start as negative of the target row_offset = -target_position[0] cells = [] for row in formation: col_offset = -target_position[1] cells_row = [] for col in row: #0 means the cell is empty if col == 0: cells_row.append(None) #1 means a cell sprite should be added here elif col == 1: new_cell = Cell(row_offset, col_offset, cell_image, target) Group.add(self, new_cell) cells_row.append(new_cell) #anything else means wtf are you doing else: raise col_offset += 1 cells.append(cells_row) row_offset += 1 self.cells = cells self.delay = 0
def __init__(self, bullets): """Initializes the group and makes a wave of enemies window_size is a tuple with the window dimensions (width, height) rows, cols are the height and width resp. of enemies in the waves gap is the number of pixels between each sprite speed is the number of pixels moved at once move_delay is the number of frames waited between movements shoot_delay is the number of frames between enemy shots bullets is a Group that will hold the enemies' bullets sprite_filename is the sprite file for the ships """ Group.__init__(self) self.window_size = window_size self.rows = wave_rows self.cols = wave_cols self.gap = wave_gap self.speed = enemy_speed self.move_delay = enemy_delay self.shoot_delay = enemy_shoot_delay self.bullets = bullets self.sprite_filename = enemy_filename self.build_wave()
def __init__(self): Group.__init__(self); pass;
def __init__(self, clue): Group.__init__(self) self.sprite_group = Group() self.Collision = [] self.clue = clue
def __init__(self, bounds): Group.__init__(self) self.bounds = bounds self.spawn_timer = 0
def __init__(self, w, h, is_server): Group.__init__(self) self.w = w self.h = h self.is_server = is_server
def __init__(self, *sprites): self._spritelist = [] Group.__init__(self, *sprites)
def __init__(self, count): Group.__init__(self) self.max = count
def __init__(self): Group.__init__(self) self.id_dict = dict()
def __init__(self): """ Constructor. """ Group.__init__(self)
def __init__(self): Group.__init__(self) dispatcher.connect(self.add_sprite, signal=signals.NEW_OBJECT, sender=Player)
def __init__(self): Group.__init__(self)
def __init__(self): Group.__init__(self) self.total_spawns = 0
def __init__(self, *sprites): Group.__init__(self, *sprites)
def __init__(self, fase): Group.__init__(self) self.fase = fase self.coisas = [] self.win = False # listas de cada coisa self.lixos = [] self.lixeiras = [] self.flores = [] self.mouse = fase.jogo.central.janela.mouse self.mouse.mundo = self self.gui = Gui() self.texto = Texto(texto="TEXTO", tamanho=25, cor=(200, 100, 100), img_botao="botao.png") self.texto.alt_pos(400, 20) # self.gui.adi(self.texto) desenho = Desenho("barra_de_lixo.png") desenho.alt_pos(0, 0) self.gui.adi(desenho) desenho = Desenho("fundo_simb.png") desenho.alt_pos(500, 0) self.gui.adi(desenho) self.simbolo = Desenho("fundo_simb.png") self.simbolo.alt_pos(500, 0) self.gui.adi(self.simbolo) #self.alt_controle_som(True) self.controleSom = BotaoToggle(self.alt_controle_som, "", "comSom.png", self.alt_controle_som, "", "semSom.png") self.controleSom.posicionar(85, 25) self.gui.adi(self.controleSom) self.controleSom = BotaoToggle(barulho.desligar, "", "comMusica.png", barulho.ligar, "", "semMusica.png") self.controleSom.posicionar(115, 25) self.gui.adi(self.controleSom) self.bot_voltar = BotaoSimples(self.fase.fim, "", "botao_menu.png") self.bot_voltar.posicionar(35, 25) self.gui.adi(self.bot_voltar) self.vitoria = animacoes.animar_vitoria self.estado_vitoria = 200 # contador para a animacao de vitoria self.contador_final = 200 self.venceu = False self.lixeiras.append(Lixeira(self, 50, 568, "Metal", "lixeira_metal")) self.lixeiras.append(Lixeira(self, 240, 568, "Papel", "lixeira_papel")) self.lixeiras.append(Lixeira(self, 430, 568, "Plastico", "lixeira_plastico")) self.lixeiras.append(Lixeira(self, 620, 568, "Vidro", "lixeira_vidro")) self.lixeiras.append(Lixeira(self, 810, 568, "Organico", "lixeira_organico"))
def __init__(self, count): Group.__init__(self) self.count = count
def __init__(self): Group.__init__(self) dispatcher.connect(self.add_sprite, signal=signals.NEW_OBJECT, sender=Coin)
def __init__(self): Group.__init__(self) self._head = Block((50, 50)) self._tail_position = [50, 80] self.add(self._head, Block((50, 60)), Block((50, 70)), Block((50, 80)))
def __init__(self): Group.__init__(self) createTimeout(800, 6000, self._createTree) self.stopped = True