def enter(): global back_music image = load_image('ui\\title.png') back_music = load_music('Music\\ingame_Bgm.mp3') back_music.set_volume(64) back_music.repeat_play() get_time() global boy, boy1, grass, Inventory, bullet, score bullet = Bullet() boy = Boy() boy1 = Boy() score = game_Score() Inventory = inventory() grass = Grass() boy.Get_maptile(grass.line) boy1.Get_maptile(grass.line) boy.Get_inven(Inventory) boy1.Get_inven(Inventory) game_world.add_object(grass, 0) game_world.add_object(score, 0) game_world.add_object(Inventory, 0) game_world.add_object(boy, 1) game_world.add_object(boy1, 1) global Monster
def enter(): global slime slime = Slime() game_world.add_object(slime, 1) global grass grass = Grass() game_world.add_object(grass, 0) global blocks blocks = [BLOCK() for i in range(100)] for i in range(8): blocks[i].pos(check[i]) game_world.add_objects(blocks, 1) global g_blocks g_blocks = [G_BLOCK() for i in range(100)] for i in range(5): g_blocks[i].pos(check2[i]) game_world.add_objects(g_blocks, 1) global b_blocks b_blocks = [B_BLOCK() for i in range(100)] for i in range(5): b_blocks[i].pos(check3[i]) game_world.add_objects(b_blocks, 1) global background background = Background() game_world.add_object(background, 0)
def create_world(): global boy, grass, balls, crowns, eventback boy = Boy() balls = [Ball() for i in range(10)] crowns = Crown() grass = Grass() eventback = EventBackground()
def enter(): global boy global Die boy = Boy() grass = Grass() game_world.add_object(grass, 0) game_world.add_object(boy, 1)
def enter(): global boy, ghost boy = Boy() ghost = Boy() grass = Grass() game_world.add_object(grass, 0) game_world.add_object(boy, 1)
def __init__(self, caption): """Инициализация основных параметров.""" self.caption = caption self.config = Config() self.color = Colors() # Заголовок экрана pygame.display.set_caption(self.caption) # Экран с заданным размером self.screen = pygame.display.set_mode(self.config.screen_size) # Создается группа Точек/список спрайтов self.dot_list = pygame.sprite.Group() # Создается группа Травинок/список спрайтов self.grass_list = pygame.sprite.Group() # Создается группа всех спрайтов self.all_sprites_list = pygame.sprite.Group() for i in range(10): # Создание Точки self.dot = Dot() # Выбор случайных координат размещения Точки self.dot.rect.x = random.randrange(self.config.screen_width) self.dot.rect.y = random.randrange(self.config.screen_height) # Добавить точки в список точек self.dot_list.add(self.dot) self.all_sprites_list.add(self.dot) for i in range(100): # Создание травинки self.grass = Grass() # Выбор случайных координат размещения травинки self.grass.rect.x = random.randrange(self.config.screen_width) self.grass.rect.y = random.randrange(self.config.screen_height) # Добавить травинку в список травинок self.grass_list.add(self.grass) self.all_sprites_list.add(self.grass)
def enter(): global boy grass = Grass() bird = Bird() game_world.add_object(grass, 0) game_world.add_object(bird, 1)
def create_world(): global boy, grass, balls, big_balls boy = Boy() big_balls = [BigBall() for i in range(10)] balls = [Ball() for i in range(10)] balls = big_balls + balls grass = Grass()
def __init__(self, width, height, caption): pygame.init() # Размеры окна и заголовок self.width = width self.height = height self.size = (self.width, self.height) self.caption = caption pygame.display.set_caption(self.caption) # Экран с заданным размеров self.screen = pygame.display.set_mode(self.size) # Полноэкранный режим # self.screen = pygame.display.set_mode(self.size, pygame.FULLSCREEN) # Инициализация настроек self.config = Config() # Инициализация набора цветов self.colors = Colors() # Инициализация счетчика шагов self.step = 0 # Инициализация списков объектов (Точки и трав) self.dotsList = [] # Инициализация первой точки и добавление в список Точек self.firstDot = Dot() self.dotsList.append(self.firstDot) # Список координат трав self.grass = Grass() self.grassesCoords = self.grass.addGrass(self.width, self.height, self.grass.startQuantity) self.font = pygame.font.SysFont(None, 16) self.screen_rect = self.screen.get_rect() pygame.mouse.set_visible(False)
def enter(): global boy, grass, fire boy = Boy() grass = Grass() fire = Ball() game_world.add_object(grass, 0) game_world.add_object(boy, 1) game_world.add_object(fire, 1)
def enter(): global boy boy = Boy() game_world.add_object(boy, 1) global grass grass = Grass() game_world.add_object(grass, 0)
def getZeroField(self): field = np.zeros([self.face, self.face], dtype=object) for row in range(self.face): for col in range(self.face): field[row][col] = Grass(0, 0) return field
def show_score(self): self.screen.blit(self.score_grass, self.grass_score_rect) self.screen.blit(self.score_heart, self.heart_score_rect) # 绘制右上角的草的图案 grass = Grass(self.screen, 1100, 10) grass.draw_grass() # 绘制右上角的心的图案 heart = Heart(self.screen, 1000, 10) heart.draw_heart()
def enter(): server.boy = Boy() game_world.add_object(server.boy, 1) server.grass = Grass() game_world.add_object(server.grass, 0) server.balls = [Ball() for i in range(10)] game_world.add_objects(server.balls, 1)
def enter(): #global boy global bird #boy = Boy() bird = Bird() grass = Grass() game_world.add_object(grass, 0) #game_world.add_object(boy, 1) game_world.add_object(bird, 1)
def generate_grass(amount): dx = size[0] / amount grass = [] for x in range(amount): g = Grass(x * dx, 600, 300 + randint(-100, 100), 6) grass.append(g) return grass
def __init__(self, width, height, caption): pygame.init() # Размеры окна и заголовок self.width = width self.height = height self.size = (self.width, self.height) self.caption = caption pygame.display.set_caption(self.caption) # Экран с заданным размеров self.screen = pygame.display.set_mode(self.size) # Полноэкранный режим # self.screen = pygame.display.set_mode(self.size, pygame.FULLSCREEN) # Инициализация настроек self.config = Config() # Инициализация набора цветов self.colors = Colors() # Инициализация счетчика шагов self.step = 0 # Инициализация списков объектов (Точки и трав) self.dotsList = [] # Инициализация первой точки и добавление в список Точек self.firstDot = Dot() self.dotsList.append(self.firstDot) # Список координат трав self.grass = Grass() self.grassesCoords = self.grass.addGrass(self.width, self.height, self.grass.startQuantity) # Поверхность для создания графика статистики self.statsurf = pygame.Surface((240, 240)) self.font_legend = pygame.font.SysFont("Roboto", 24) self.screen_rect = self.statsurf.get_rect() # Поверхность для создания симуляции self.simsurf = pygame.Surface((1040, 720)) self.font_tooltip = pygame.font.SysFont("Roboto", 12) pygame.mouse.set_visible(False) self.filename = "stat.csv" self.frame = 0 self.data = [["Time", "Population", "Resources", "Slows", "Middles", "Fasts"]] # Группы по скорости self.slowDots = [] self.middleDots = [] self.fastDots = [] self.time = [] self.population = [] self.resources = [] self.slows = [] self.middles = [] self.fasts = []
def enter(): global boy boy = Boy() game_world.add_object(boy, 1) global grass grass = Grass() game_world.add_object(grass, 0) global bricks bricks = [Brick(300 + 300 * i, 100 + 50 * i) for i in range(5)] game_world.add_objects(bricks, 1)
def enter(): global boy boy = Boy() game_world.add_object(boy, 1) global grass grass = Grass() game_world.add_object(grass, 0) global balls balls = [Ball() for i in range(10)] + [BigBall() for i in range(10)] # 리스트 컴프리헨션 game_world.add_objects(balls, 1) # 게임월드에 집어넣음 add_objects() 함수가 추가됨 리스트에 있는 객체를 모두 게임월드에 집어넣음
def enter(): global boy boy = Boy() game_world.add_object(boy, 1) global grass grass = Grass() game_world.add_object(grass, 0) global balls balls = [Ball() for i in range(10)] game_world.add_objects(balls, 1)
def create_world(): global player, grass, stage, mobs, mobs2, mobs4, big_mobs, big_mobs2, big_mobs4, background, background2, bullet, bullets, bullet2, bullets2, grass2, score player = Player() grass = Grass() bullet = Bullet() bullets = [Bullet() for i in range(10)] bullet2 = Bullet2() bullets2 = [Bullet2() for i in range(10)] grass = Grass() grass2 = Grass2() background = Background() if (stage == 1): grass2 = Grass2() grass = Grass() background = Background() background2 = False big_mobs = [BigMob() for i in range(410)] big_mobs2 = [BigMob2() for i in range(0)] big_mobs4 = [BigMob4() for i in range(1)] if (stage == 2): grass2 = Grass2() grass = Grass() background = False background2 = Background2() big_mobs = [BigMob() for i in range(0)] big_mobs2 = [BigMob2() for i in range(800)] big_mobs4 = [BigMob4() for i in range(1)] mobs = [Mob() for i in range(0)] mobs = big_mobs + mobs mobs2 = [Mob2() for i in range(0)] mobs2 = big_mobs2 + mobs2 mobs4 = [Mob4() for i in range(0)] mobs4 = big_mobs4 + mobs4
def enter(): global boy boy = Boy() game_world.add_object(boy, 1) global grass grass = Grass() game_world.add_object(grass, 0) global balls balls = [Ball() for i in range(10)] + [BigBall() for i in range(20)] game_world.add_objects(balls, 1) brick.image = load_image('brick180x40.png')
def enter(): global boy boy = Boy() game_world.add_object(boy, 1) global grass grass = Grass() game_world.add_object(grass, 0) # fill here for balls global balls #balls = [Ball() for i in range(10)] balls = [Ball() for i in range(10)] + [BigBall() for i in range(10)] game_world.add_objects(balls, 1)
def enter(): global boy boy = Boy() game_world.add_object(boy, 1) global grass grass = Grass() game_world.add_object(grass, 0) global balls balls = [Ball() for i in range(10)] + [BigBall() for i in range(10)] global brick brick = Brick() game_world.add_object(brick, 1) for i in range(20): game_world.add_object(balls[i], 1)
def init_game(): for y, row in enumerate(settings.field): for x, column in enumerate(row): if column == 1: settings.grass.append( Grass(settings.main_surf, settings.field_size, settings.cells_size, (x, y))) elif column == 2: settings.armor.append( Armor(settings.main_surf, settings.field_size, settings.cells_size, (x, y))) elif type(column) is list: for add_nums in column: if add_nums[0] == 0: if add_nums[1] % 2 == 0: ind = 0 else: ind = 3 else: if add_nums[1] % 2 == 0: ind = 2 else: ind = 1 settings.bricks.append( Brick(settings.main_surf, settings.field_size, settings.cells_size, (50 + settings.cells_size * x + add_nums[0] * settings.cells_size // 2, 50 + settings.cells_size * y + add_nums[1] * settings.cells_size // 4), ind)) elif column == 4: settings.fin.append( Fin(settings.main_surf, settings.field_size, settings.cells_size, (x, y))) settings.fin_pos.append([x, y]) elif column == 5: settings.spawns.append([x, y]) elif column == 6: settings.bots_spawn.append([x, y]) elif column == 7: settings.water.append( Water(settings.main_surf, settings.field_size, settings.cells_size, (x, y)))
def enter(): global boy boy = Boy() game_world.add_object(boy, 1) global grass grass = Grass() game_world.add_object(grass, 0) #global bird #Birds = [Bird() for i in range(5)] #for bird in Birds: # bird = Bird() # game_world.add_object(bird,2) global balls balls=[Ball() for i in range(10)]+[BigBall() for i in range(10)] game_world.add_objects(balls,1)
def enter(): global boy boy = Boy() game_world.add_object(boy, 1) global grass grass = Grass() game_world.add_object(grass, 0) global balls balls = [Ball() for i in range(10)] game_world.add_objects(balls, 1) global background background = Background() game_world.add_object(background, 0) background.set_center_object(boy)
def enter(): global by, BGM, metronom, EnterTime, gameOverImage grass = Grass() metronom = Metro() game_world.add_object(grass, 0) game_world.add_object(metronom, 4) mapper() bulletRegister() if BGM is None: BGM = Stage1_Bgm() else: BGM.bgm.repeat_play() EnterTime = get_time() by = boy.Boy() game_world.add_object(by, 2) gameOverImage = GameOverImage() game_world.add_object(gameOverImage, 4)
def __init__(self, width=800, height=600, food_size=5, n_agents=1, caption='Mundo das ovelhas', food_energy=10, time_to_growth=400, flat=False, mutation=1, speed=4, energy=20, reproduction_energy=40): self.width = width self.height = height self.food_size = food_size self.n_agents = n_agents self.sheeps = list() self.foods = list() self.world = World(width, height, caption, flat) self.mutation = mutation # Instancia os recursos for x in range(0, self.world.width, food_size): for y in range(0, self.world.height, food_size): self.foods.append( Grass(x, y, food_size, food_energy, time_to_growth)) # Instancia os agentes for i in range(N_AGENTS): self.sheeps.append( Sheep( randint(0, self.world.width), randint(0, self.world.height), #random(width), #random(height), choice(SHEEP_COLORS), speed, energy, reproduction_energy))
def create_world(): global prince, rose, sky, grass, balls, big_balls, icon_pause, icon_planet, blood_gage, tree, tree2, trees, trees2, dirty_waters, item_barriers, item_boosters prince = Prince() rose = Rose() icon_pause = Icon_pause() icon_planet = Icon_planet() blood_gage = Blood_gage() tree = Tree() tree2 = Tree2() # trees = [Tree() for i in range(5)] # trees2 = [Tree2() for i in range(5)] dirty_waters = [Dirty_water() for i in range(2)] item_barriers = [Item_barrier() for i in range(3)] item_boosters = [Item_booster() for i in range(3)] # big_balls = [BigBall() for i in range(10)] # big_balls_for_collsion_check = big_balls, [] # balls = [Ball() for i in range(10)] # balls = big_balls + balls grass = Grass() sky = Sky()