def __init__(self, screen): print("Initializing Lumidify Isometric Engine (LIE) Version 1.0 ...") self.screen = screen self.screen.blit(FONT.render("Loading...", True, (255, 255, 255)), (0, 0)) self.screen.blit( FONT.render("Remember - patience is a virtue.", True, (255, 255, 255)), (0, 40)) pygame.display.update() self.tiles, self.obstacles, self.characters, self.items, self.bullets = load_tiles( ) self.floor = Floor(self.screen, self.tiles) self.obstacles = Obstacles(self.screen, self.obstacles, self.characters, self.items, self.bullets, self) temp = self.obstacles.characters["GUB"].copy() temp["weapon"] = None self.player = Montag(self.screen, x=0, y=0, obstaclemap=self.obstacles, **temp) self.obstacles.player = self.player self.game_variables = {} self.active_layer = 0 self.screen_offset = [0, 0] self.loaded_maps = {} self.saved_maps = [] self.current_map = "" self.wongame = False self.lostgame = False self.show_fps = True
def game_loop(): """ Main game loop. Contains event handling for crashes, moving between menus, and score-keeping.""" # Defines object starting positions. chicken_x = random.randrange(25, aspect_ratio[0] - 100) chicken_y = -aspect_ratio[1] vehicle_x = aspect_ratio[0] * 0.455 vehicle_y = aspect_ratio[1] * 0.75 # Defines object rectangles for collision detection. chicken = Obstacles.Chicken(game_display, chicken_x, chicken_y, 74, 74) car = Obstacles.Vehicle(game_display, vehicle_x, vehicle_y, 81, 240) # Vertical displacement of chicken with each frame. chicken_speed = aspect_ratio[1] * 0.00833 # Continuously updating score for the game. score = 0 # Sets maximum number of chickens that will appear in the game. chicken_count = 30 while chicken_count >= 0: # Controls event handling for quitting and car movement. for event in pygame.event.get(): Menus.quit_game(event) car.move(event) # Adds a hard cap to the chicken speed. if chicken_speed < 0.02 * aspect_ratio[1]: chicken_speed += 0.00075 * aspect_ratio[1] chicken.move(chicken_speed) # Handles scoring conditions. if chicken.collide(car): if score >= 50: score -= 50 else: score = 0 elif car.xpos < chicken.xpos < car.xpos + car.width or \ car.xpos < chicken.xpos + chicken.width + car.xpos + car.width: score += int(30**(1 / (car.ypos - (chicken.ypos + chicken.height)))) # Draws everything to the game display and updates chicken_count. game_display.blit(background, (0, 0)) chicken_count = chicken.spawn(chicken_count) chicken.draw() car.draw() # Updates the surface display. pygame.display.update() clock.tick(60)
def runSim(): nodesExplored = {} q = [] success, solution = generatePath(q, startEndCoor, nodesExplored, 0) solution.reverse() Q = Quadrotor(ax, x=s1, y=s2, z=s3, roll=roll, pitch=pitch, yaw=yaw, size=1, show_animation=show_animation) O = {} region = [[0, 5, 0, 5], [6, 10, 0, 5], [0, 5, 6, 10], [6, 10, 6, 10]] for i in range(4): O[i] = Obstacles(ax, x=region[i][0], y=region[i][3], z=2.5, roll=roll, pitch=pitch, yaw=yaw, size=1, show_animation=show_animation, region=region[i]) plotExploredNodes(nodesExplored, ax2) plotPath(solution, ax2) followPath(Q, solution, O, q, nodesExplored, 0)
def run_agent(pos, player, queue, sema=None, train=True): global WIDTH, HEIGHT if not train: pygame.init() surface = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("FlappyBirdAI") clock = pygame.time.Clock() score = 0 bird = Bird.Bird(WIDTH, HEIGHT, 8) obs = Obstacles.Obstacles(WIDTH, HEIGHT, 30, 50, 125, 200, 2) end = False while not end: if not train: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() end = True if event.type == pygame.MOUSEBUTTONDOWN: end = True obsx, obsy = obs.getClosestObsticle(bird.x, bird.size) data = [ bird.x / WIDTH, bird.y / HEIGHT, obsx / WIDTH, obsy / HEIGHT, bird.velocity / 100 ] jump = player.forward(data, 's') if jump == 1: bird.jump() out = bird.move() obs.moveObstacles() hit, rev = obs.detectCollision(bird.x, bird.y, bird.size) if hit or out or (score > 200000 and train): end = True if train: print(pos, score) if not queue is None: queue.put((pos, score)) else: score += 1 + rev if not train: if hit or out: col = (255, 0, 0) else: col = (0, 255, 0) surface.fill((0, 0, 0)) bird.draw(surface, col) obs.draw(surface) pygame.display.flip() clock.tick(60) if not sema is None: sema.release()
def read_obstacles(file_name): obstacles = [] with open(file_name, 'r') as file: reader = csv.reader(file, delimiter=',') for row in reader: if (row[0][0].isnumeric()): obstacle = Obstacles(float(row[0]), float(row[1]), float(row[2]) / 2) obstacles.append(obstacle) return obstacles
def build_obj_map_Finish(): # narrow tunnel with moving fire array = [] array = [ ob.Floor(x=MAP_UNIT_X * 2, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 20, sizey=MAP_UNIT_Y * 2), ] return array
def __init__(self, screen): print("Initializing Lumidify Isometric Engine (LIE) Version 1.0 ...") self.screen = screen self.screen.blit(FONT.render("Loading...", True, (255, 255, 255)), (0, 0)) self.screen.blit(FONT.render("Patience is a virtue.", True, (255, 255, 255)), (0, 40)) pygame.display.update() self.tiles, self.obstacles, self.characters, self.items, self.bullets = load_tiles() self.floor = Floor(self.screen, self.tiles) self.obstacles = Obstacles(self.screen, self.obstacles, self.characters, self.items, self.bullets, self) temp = self.obstacles.characters["GUB"].copy() temp["weapon"] = None self.player = Montag(self.screen, x=0, y=0, obstaclemap=self.obstacles, **temp) self.obstacles.player = self.player self.game_variables = {} self.active_layer = 0 self.screen_offset = [0, 0] self.loaded_maps = {} self.saved_maps = [] self.current_map = "" self.wongame = False self.lostgame = False
def __init__(self, world_map, surface): super().__init__() self.cells = [] self.surface = surface self.obstacles = [] self.color = constants.SILVER self.cp1 = [] self.cp2 = [] posCell = 0 for col, tiles in enumerate(world_map): for row, tile in enumerate(tiles): if tile == '.' or tile == 'a': posCell += 1 #keep this to update sprite when agent cross cell c = Cell(posCell, row, col, obs=False) self.cells.append(c) self.color = constants.SILVER self.setCell(row, col, 'cell', False, False, True, None, '') elif tile == 'o': #o = type('obj', (object,), {'x': row, 'y': col}) o = Obstacles.Obstacle(row, col) self.obstacles.append(o) self.color = constants.SILVER self.setCell(row, col, 'cell', True, False, False, None, '') elif tile == '1': self.color = constants.GRAY cp = Company.Company(row, col, 'cp1') self.cp1.append(cp) self.setCell(row, col, 'cp1', False, False, True, None, '') elif tile == '2': self.color = constants.LIGHTLATEGREY cp = Company.Company(row, col, 'cp2') self.cp2.append(cp) self.setCell(row, col, 'cp2', False, False, True, None, '')
def is_collision(A, B, obstacles): '''checks if any obstacle is in collision with line segment''' '''between nodes A and B''' eps = 0.001 d_AB = dist(A, B) for C in obstacles: # D is a point on AB such that CD is normal to AB dot = ((C.x - A.x) * (B.x - A.x) + (C.y - A.y) * (B.y - A.y)) / (d_AB * d_AB + eps) d_AD = abs(dot * d_AB) x = A.x + (B.x - A.x) * dot y = A.y + (B.y - A.y) * dot D = Obstacles(x, y) d_BD = dist(B, D) d_DC = dist(D, C) if d_DC > C.r: continue if (abs(d_AD + d_BD - d_AB) < eps): return True if (d_AD <= C.r or d_BD <= C.r): return True return False
def build_obj_map_level_5(): #level 5 array = [] array = [ #starting stairs ob.Floor(x=MAP_UNIT_X * 2, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 22, sizey=MAP_UNIT_X * 2), ob.Floor(x=MAP_UNIT_X * 16, y=ground - MAP_UNIT_Y * 4, sizex=MAP_UNIT_X * 8, sizey=MAP_UNIT_X * 2), ob.Floor(x=MAP_UNIT_X * 20, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 4, sizey=MAP_UNIT_X * 2), #first pit / 1x vertical flame ob.Flame_UFO(x=MAP_UNIT_X * 28, y=ground - MAP_UNIT_Y * 14, speed_y=0.32 * MAP_UNIT_Y), #Next platform ob.Floor(x=MAP_UNIT_X * 34, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 6, sizey=MAP_UNIT_X * 6), #second pit / 1x vertical flame ob.Flame_UFO(x=MAP_UNIT_X * 44, y=ground - MAP_UNIT_Y * 14, speed_y=0.32 * MAP_UNIT_Y), #Next platform ob.Floor(x=MAP_UNIT_X * 50, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 4, sizey=MAP_UNIT_X * 2), #third pit / 2x vertical flame ob.Flame_UFO(x=MAP_UNIT_X * 57, y=ground - MAP_UNIT_Y * 14, speed_y=0.32 * MAP_UNIT_Y), ob.Flame_UFO(x=MAP_UNIT_X * 61, y=ground, speed_y=-0.32 * MAP_UNIT_Y), #Floor ob.Floor(x=MAP_UNIT_X * 66, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 150, sizey=MAP_UNIT_X * 2), #horzontal tunnel ob.Floor(x=MAP_UNIT_X * 70, y=0, sizex=MAP_UNIT_X * 8, sizey=576 - MAP_UNIT_X * 5), ob.Floor(x=MAP_UNIT_X * 78, y=0, sizex=MAP_UNIT_X * 4, sizey=576 - MAP_UNIT_X * 10), ob.Floor(x=MAP_UNIT_X * 82, y=0, sizex=MAP_UNIT_X * 6, sizey=576 - MAP_UNIT_X * 5), ob.Floor(x=MAP_UNIT_X * 88, y=0, sizex=MAP_UNIT_X * 4, sizey=576 - MAP_UNIT_X * 10), ob.Floor(x=MAP_UNIT_X * 92, y=0, sizex=MAP_UNIT_X * 6, sizey=576 - MAP_UNIT_X * 5), #flames ob.Flame_Move(x=MAP_UNIT_X * 88, y=ground - MAP_UNIT_Y * 4, speed_x=0.2 * MAP_UNIT_X), ob.Flame_Move(x=MAP_UNIT_X * 96, y=ground - MAP_UNIT_Y * 4, speed_x=-0.2 * MAP_UNIT_X), #blocks ob.Block(x=MAP_UNIT_X * 2, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 4, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 6, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 8, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 10, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 12, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 14, y=ground - MAP_UNIT_Y * 4, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 16, y=ground - MAP_UNIT_Y * 4, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 18, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 20, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 22, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 34, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 36, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 38, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 50, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 52, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 2), ob.Block(x=MAP_UNIT_X * 66, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_X * 50), ] return array
def start(self): old_score = 0 count = 0 snake = Snake.Snake(self.x, self.y, 'red') food = Food.Food(self.x, self.y) pygame.mixer.music.load('data/music/soundtrack.mp3') if self.SoundButton.check_mode(): pygame.mixer.music.play(1) pygame.mixer.music.set_volume(0.4) self.game_on = True while self.game_on: for event in pygame.event.get(): if event.type == pygame.QUIT: self.terminate() if event.type == pygame.KEYDOWN: if event.key == pygame.K_RIGHT or event.key == ord('d'): snake.check_direction("RIGHT") elif event.key == pygame.K_LEFT or event.key == ord('a'): snake.check_direction("LEFT") elif event.key == pygame.K_UP or event.key == ord('w'): snake.check_direction("UP") elif event.key == pygame.K_DOWN or event.key == ord('s'): snake.check_direction("DOWN") elif event.key == pygame.K_ESCAPE: pygame.mixer.music.pause() menu = Menu.PauseMenu(self.screen_size, 1) menu.start() pygame.mixer.music.unpause() if event.type == pygame.MOUSEBUTTONDOWN: self.get_click(event.pos) self.menu_screen.blit(self.menu_background_image, (0, 0)) self.SoundButton.draw() snake.change_head_pos() ate_snake = snake.check_snake(food.get_pos(), food.size[0]) if ate_snake: self.score += 1 if self.score != old_score and self.score % self.score_next_wall == 0: wall = Obstacles.Wall(self.x, self.y) wall.spawn(self.coords_walls) self.coords_walls.append(wall.get_pos()) self.level += 1 old_score = self.score if self.SoundButton.check_mode(): pygame.mixer.Sound.play(self.level_up_sound) self.walls.append(wall) if ate_snake: if self.SoundButton.check_mode(): pygame.mixer.Sound.play(self.food_sound) food.update(self.coords_walls) for wall in self.walls: self.menu_screen.blit(wall.image, wall.rect) snake.snake_design() snake.update(self.menu_screen) size_wall = self.get_wall_size() snake.check_collision(self, self.coords_walls, size_wall) self.menu_screen.blit(food.image, food.rect) self.show_score() self.show_level() pygame.display.flip() self.clock.tick(self.fps) count += 1 self.show_score()
def runGame(self, simulateState): # list of boids boidSystems = [] # generate and create boids for i in range(2): num1 = random.randint(20, 40) scale1 = 30 / num1 newBoidSystem = Boids(num1, scale1, self.screen_width, self.screen_height) newBoidSystem.makeBoid() boidSystems.append(newBoidSystem) obstacles = Obstacles() self.simulateState = simulateState count = 0 self.frame_surface.fill((0, 0, 0)) self.frame_marker.fill((0, 0, 0)) #game loop while not self.done: # handle user input for event in pygame.event.get(): if event.type == pygame.QUIT: self.done = True elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 3: # create an array of boids num2 = random.randint(20, 40) scale2 = 30 / num1 controller = copy.deepcopy(boidSystems[0].controller) newBoidSystem = Boids(num2, scale2, self.screen_width, self.screen_height, controller) newBoidSystem.makeBoid() boidSystems.append(newBoidSystem) if len(boidSystems) > 5: boidSystems.pop(0) elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: # create single boid mousePos = pygame.mouse.get_pos() mouseVec1 = pygame.math.Vector2((mousePos)) for i in range(len(boidSystems)): boidSystems[i].addBoid(mouseVec1) elif event.type == pygame.KEYDOWN: if event.unicode == "A" or event.unicode == "a": for i in range(len(boidSystems)): # Alignment state if boidSystems[i].controller[0] == True: boidSystems[i].controller[0] = False boidSystems[i].stateChange() else: boidSystems[i].controller[0] = True boidSystems[i].stateChange() elif event.unicode == "C" or event.unicode == "c": for i in range(len(boidSystems)): # Cohesion state if boidSystems[i].controller[1] == True: boidSystems[i].controller[1] = False boidSystems[i].stateChange() else: boidSystems[i].controller[1] = True boidSystems[i].stateChange() elif event.unicode == "S" or event.unicode == "s": for i in range(len(boidSystems)): # Seperation state if boidSystems[i].controller[2] == True: boidSystems[i].controller[2] = False boidSystems[i].stateChange() else: boidSystems[i].controller[2] = True boidSystems[i].stateChange() elif event.unicode == "N" or event.unicode == "n": for i in range(len(boidSystems)): # Noise State if boidSystems[i].controller[3] == True: boidSystems[i].controller[3] = False boidSystems[i].stateChange() else: boidSystems[i].controller[3] = True boidSystems[i].stateChange() elif event.unicode == "B" or event.unicode == "b": for i in range(len(boidSystems)): # Debug State if boidSystems[i].controller[5] == True: boidSystems[i].controller[5] = False boidSystems[i].stateChange() else: boidSystems[i].controller[5] = True boidSystems[i].stateChange() elif event.unicode == "F" or event.unicode == "f": # Change to fullscreen if self.screen.get_flags() & pygame.FULLSCREEN: pygame.display.set_mode( (self.screen_width * self.scale, self.screen_height * self.scale), pygame.HWSURFACE | pygame.DOUBLEBUF, 32) else: pygame.display.set_mode( (self.screen_width * self.scale, self.screen_height * self.scale), pygame.HWSURFACE | pygame.DOUBLEBUF | pygame.FULLSCREEN, 32) elif event.unicode == "R" or event.unicode == "r": # Random State if self.randomState == True: self.randomState = False else: self.randomState = True elif event.unicode == "D" or event.unicode == "d": # Draw State if self.simulateState == True: self.simulateState = False else: self.simulateState = True elif event.unicode == "W" or event.unicode == "w": # Make wall mousePos = pygame.mouse.get_pos() mouseVec2 = pygame.math.Vector2((mousePos)) obstaclesRadius = random.randint(10, 20) obstacles.makeObstacles(mouseVec2, obstaclesRadius) # Drawing Styles elif event.unicode == "1": for i in range(len(boidSystems)): # Triangle State boidSystems[i].controller[4] = 1 elif event.unicode == "2": for i in range(len(boidSystems)): # Arrow Trails State boidSystems[i].controller[4] = 2 elif event.unicode == "3": for i in range(len(boidSystems)): # Circle State boidSystems[i].controller[4] = 3 elif event.unicode == "4": for i in range(len(boidSystems)): # Trails State boidSystems[i].controller[4] = 4 elif event.unicode == "5": for i in range(len(boidSystems)): # Diamond State boidSystems[i].controller[4] = 5 elif event.unicode == "6": for i in range(len(boidSystems)): # Diamond Trail State boidSystems[i].controller[4] = 6 elif event.unicode == "7": for i in range(len(boidSystems)): # Paper Trail State boidSystems[i].controller[4] = 7 kinectTracker = trackKinect(self.kinect) if kinectTracker != None: self.cur_left, self.cur_right, self.left_State, self.right_State = kinectTracker else: mousePos = pygame.mouse.get_pos() Rx, Ry = mousePos[0], mousePos[1] self.cur_right = Rx, Ry self.right_State = 3 self.cur_left = Rx, Ry self.left_State = 3 self.stateChange(boidSystems) if self.randomState == False: #mousePos = pygame.mouse.get_pos() #Rx, Ry = mousePos[0], mousePos[1] Rx = (self.cur_right[0]) Ry = (self.cur_right[1]) Lx = (self.cur_left[0]) Ly = (self.cur_left[1]) target1 = pygame.math.Vector2((Rx, Ry)) target2 = pygame.math.Vector2((Lx, Ly)) else: if count % 30 == 0: target1 = pygame.math.Vector2( (random.random() * self.screen_width, random.random() * self.screen_height)) target2 = pygame.math.Vector2( (random.random() * self.screen_width, random.random() * self.screen_height)) count += 1 if self.randomColor == True: for i in range(len(boidSystems)): boidSystems[i].randomColor() self.randomColor = False # else: # self.colorCount += 1 # if self.colorCount == 1: # for i in range(len(boidSystems)): # tempNum = boidSystems[i].num # tempScale = boidSystems[i].scale # controller = copy.deepcopy(boidSystems[0].controller) # newBoidSystem = Boids( # tempNum, tempScale, self.screen_width, self.screen_height, controller) # newBoidSystem.makeBoid() # boidSystems.append(newBoidSystem) # boidSystems.pop(0) for i in range(len(boidSystems)): if i % 2 == 0: boidSystems[i].update(target1, target2, obstacles.obstaclesList) else: boidSystems[i].update(target2, target1, obstacles.obstaclesList) # reset and draw things to screen if self.simulateState: # drawing mode off (keep filling the background) self.frame_surface.fill((0, 0, 0)) self.frame_marker.fill((0, 0, 0)) for i in range(len(boidSystems)): boidSystems[i].draw(self.frame_surface, self.frame_marker, False, (self.cur_left, self.cur_right), (self.left_State, self.right_State), self.countLeft, self.countRight) self.textDraw(self.frame_surface, self.frame_marker) obstacles.drawObstacles(self.frame_surface) # Kinect hand tracking circles drawKinect(self.frame_marker, self.cur_left, self.cur_right) # resize the drawing to fit the screen. h_to_w = float(self.frame_surface.get_height() ) / self.frame_surface.get_width() target_height = int(h_to_w * self.screen.get_width()) boidSurface = pygame.transform.scale( self.frame_surface, (self.screen.get_width(), target_height)) kinectSurface = pygame.transform.scale( self.frame_marker, (self.screen.get_width(), target_height)) # Draw boid layer self.screen.blit(boidSurface, (0, 0)) # Draw kinect layer self.screen.blit(kinectSurface, (0, 0)) pygame.display.update() # print(self.clock.get_fps()) self.clock.tick(120) self.kinect.close() pygame.quit()
import numpy from multiprocessing import Process import Player import Obstacle import Obstacles from ObstacleRectangle import * import Map import GameScreen from Funcs import * if __name__ == '__main__': running = True # СОЗДАНИЕ ОБЪЕКТОВ pygame.mouse.set_visible(False) player = Player.Player([300, 300]) obstacles = Obstacles.Obstacles() obstacles.add_obstacle( ObstacleRectangle([screenWidth / 2, screenHeight / 2], screenWidth, screenHeight, BLACK, WHITE)) obstacles.add_obstacle(ObstacleRectangle([400, 425], 100, 100)) obstacles.add_obstacle(ObstacleRectangle([400, 225], 100, 100)) mapp = Map.Map(player, obstacles, 0.25) gameScreen = GameScreen.GameScreen(mapp) # ОКОНЧАНИЕ ГСОЗДАНИЕ ОБЪЕКТОВ while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False pygame.event.pump() pygame.time.delay(16)
class Engine(): def __init__(self, screen): print("Initializing Lumidify Isometric Engine (LIE) Version 1.0 ...") self.screen = screen self.screen.blit(FONT.render("Loading...", True, (255, 255, 255)), (0, 0)) self.screen.blit(FONT.render("Patience is a virtue.", True, (255, 255, 255)), (0, 40)) pygame.display.update() self.tiles, self.obstacles, self.characters, self.items, self.bullets = load_tiles() self.floor = Floor(self.screen, self.tiles) self.obstacles = Obstacles(self.screen, self.obstacles, self.characters, self.items, self.bullets, self) temp = self.obstacles.characters["GUB"].copy() temp["weapon"] = None self.player = Montag(self.screen, x=0, y=0, obstaclemap=self.obstacles, **temp) self.obstacles.player = self.player self.game_variables = {} self.active_layer = 0 self.screen_offset = [0, 0] self.loaded_maps = {} self.saved_maps = [] self.current_map = "" self.wongame = False self.lostgame = False def savegame(self): if not os.path.isdir("save"): os.mkdir("save") for path, item in self.loaded_maps.items(): final_path = os.path.join("save", path) if not os.path.exists(final_path): os.makedirs(final_path) self.obstacles.save(final_path, item["characters"] + item["dead_characters"], item["item_map"], item["triggers"], item["obstacles"]) self.floor.save(os.path.join(final_path, "floor.py"), item["floor"]) with open(os.path.join(final_path, "config.py"), "w") as f: f.write("config = " + repr(item["config"])) if not os.path.exists(os.path.join("save", self.current_map)): os.makedirs(os.path.join("save", self.current_map)) self.obstacles.save(os.path.join("save", self.current_map), self.obstacles.charactermap + self.obstacles.dead_characters, self.obstacles.item_map, self.obstacles.triggers, self.obstacles.layers) self.floor.save(os.path.join("save", self.current_map, "floor.py"), self.floor.layers) with open(os.path.join("save", self.current_map, "config.py"), "w") as f: f.write("config = " + repr(self.config)) player_config = {"dead": self.player.dead, "grid_pos": self.player.grid_pos.copy(), "current_map": self.current_map, "won": self.wongame, "lost": self.lostgame, "inventory": self.player.get_inventory(), "health": self.player.health} with open(os.path.join("save", "config.py"), "w") as f: f.write("player_config = " + repr(player_config)) def load_game(self): if os.path.isdir("save"): player_config = load_module(os.path.join("save", "config.py")).player_config.copy() self.player.reset() self.player.dead = player_config["dead"] self.player.load_inventory(player_config["inventory"]) self.saved_maps = os.listdir("save") self.current_map = player_config["current_map"] self.player.health = player_config["health"] self.saved_maps = os.listdir("save") self.load_map(self.current_map, spawn_pos=player_config["grid_pos"]) if player_config["won"]: self.wingame() elif player_config["lost"]: self.losegame() def load_map(self, path, **kwargs): if path in self.saved_maps: self.saved_maps.remove(path) path = os.path.join("save", path) if self.current_map: self.loaded_maps[self.current_map] = {} self.loaded_maps[self.current_map]["floor"] = self.floor.layers.copy() self.loaded_maps[self.current_map]["obstacles"] = self.obstacles.layers.copy() self.loaded_maps[self.current_map]["characters"] = self.obstacles.charactermap.copy() self.loaded_maps[self.current_map]["dead_characters"] = self.obstacles.dead_characters.copy() self.loaded_maps[self.current_map]["item_map"] = self.obstacles.item_map.copy() self.loaded_maps[self.current_map]["bullets"] = self.obstacles.bullets.copy() self.loaded_maps[self.current_map]["triggers"] = self.obstacles.triggers.copy() self.loaded_maps[self.current_map]["config"] = self.config.copy() if path.startswith("save"): self.current_map = path[5:] else: self.current_map = path if path in self.loaded_maps: self.floor.layers = self.loaded_maps[path]["floor"].copy() self.obstacles.layers = self.loaded_maps[path]["obstacles"].copy() self.obstacles.charactermap = self.loaded_maps[path]["characters"].copy() self.obstacles.dead_characters = self.loaded_maps[path]["dead_characters"].copy() self.obstacles.item_map = self.loaded_maps[path]["item_map"].copy() self.obstacles.bullets = self.loaded_maps[path]["bullets"].copy() self.obstacles.triggers = self.loaded_maps[path]["triggers"].copy() self.config = self.loaded_maps[path]["config"].copy() else: self.floor.load_tilemap(os.path.join(path, "floor.py")) self.obstacles.load_obstaclemap(os.path.join(path, "obstacles.py")) self.obstacles.load_charactermap(os.path.join(path, "characters.py")) self.obstacles.load_item_map(os.path.join(path, "items.py")) self.obstacles.load_triggermap(os.path.join(path, "triggers.py")) self.obstacles.dead_characters = [] self.obstacles.bullets = [] self.config = load_module(os.path.join(path, "config.py")).config.copy() try: pygame.mixer.music.load(self.config.get("music", "Search_Art_S31_Undercover_Operative_0.ogg")) pygame.mixer.music.play(-1) except: pass if kwargs.get("spawn_pos", None): self.player.grid_pos = kwargs["spawn_pos"].copy() else: self.player.grid_pos = self.config.get("spawn_pos", [0, 0]).copy() self.player.reset() mapsize = self.config.get("level_dimensions", [50, 50]) self.obstacles.change_size(mapsize) self.obstacles.refresh_trigger_quadtree() self.obstacles.refresh_grid() def update(self, event=None): if not self.wongame: screen_size = self.screen.get_size() isox = (self.player.grid_pos[0] - self.player.grid_pos[1]) * (ISOWIDTH // 2) isoy = (self.player.grid_pos[0] + self.player.grid_pos[1]) * (ISOHEIGHT // 2) self.screen_offset = [screen_size[0] // 2 - isox, screen_size[1] // 2 - isoy] current_time = pygame.time.get_ticks() self.floor.update(current_time) self.obstacles.update(current_time=current_time, event=event) if event and event.type == KEYDOWN: if event.key == K_F3: self.savegame() elif event.key == K_F4: self.load_game() def wingame(self): self.wongame = True pygame.mixer.music.load("wingame.ogg") pygame.mixer.music.play(-1) def losegame(self): self.lostgame = True pygame.mixer.music.load("Sad_Piano_3.ogg") pygame.mixer.music.play(-1) def draw(self): self.floor.draw(self.screen_offset) self.obstacles.draw(self.screen_offset) if self.wongame: screen.blit(FONT.render("Congratulations, you won!", True, (255, 255, 255)), (0, 0)) elif self.lostgame: screen.blit(FONT.render("Shame be upon you! You lost!", True, (255, 255, 255)), (0, 0)) self.screen.blit(FONT.render("Health: " + str(self.player.health), True, (255, 255, 255)), (self.screen.get_size()[0] - 200, 0))
class Engine(): def __init__(self, screen): print("Initializing Lumidify Isometric Engine (LIE) Version 1.0 ...") self.screen = screen self.screen.blit(FONT.render("Loading...", True, (255, 255, 255)), (0, 0)) self.screen.blit( FONT.render("Remember - patience is a virtue.", True, (255, 255, 255)), (0, 40)) pygame.display.update() self.tiles, self.obstacles, self.characters, self.items, self.bullets = load_tiles( ) self.floor = Floor(self.screen, self.tiles) self.obstacles = Obstacles(self.screen, self.obstacles, self.characters, self.items, self.bullets, self) temp = self.obstacles.characters["GUB"].copy() temp["weapon"] = None self.player = Montag(self.screen, x=0, y=0, obstaclemap=self.obstacles, **temp) self.obstacles.player = self.player self.game_variables = {} self.active_layer = 0 self.screen_offset = [0, 0] self.loaded_maps = {} self.saved_maps = [] self.current_map = "" self.wongame = False self.lostgame = False self.show_fps = True def savegame(self): if not os.path.isdir("save"): os.mkdir("save") for path, item in self.loaded_maps.items(): final_path = os.path.join("save", path) if not os.path.exists(final_path): os.makedirs(final_path) self.obstacles.save(final_path, item["characters"] + item["dead_characters"], item["item_map"], item["triggers"], item["obstacles"]) self.floor.save(os.path.join(final_path, "floor.py"), item["floor"]) with open(os.path.join(final_path, "config.py"), "w") as f: f.write("config = " + repr(item["config"])) if not os.path.exists(os.path.join("save", self.current_map)): os.makedirs(os.path.join("save", self.current_map)) self.obstacles.save( os.path.join("save", self.current_map), self.obstacles.charactermap + self.obstacles.dead_characters, self.obstacles.item_map, self.obstacles.triggers, self.obstacles.layers) self.floor.save(os.path.join("save", self.current_map, "floor.py"), self.floor.layers) with open(os.path.join("save", self.current_map, "config.py"), "w") as f: f.write("config = " + repr(self.config)) player_config = { "dead": self.player.dead, "grid_pos": self.player.grid_pos.copy(), "current_map": self.current_map, "won": self.wongame, "lost": self.lostgame, "inventory": self.player.get_inventory(), "health": self.player.health } with open(os.path.join("save", "config.py"), "w") as f: f.write("player_config = " + repr(player_config)) def load_game(self): if os.path.isdir("save"): self.wongame = False self.lostgame = False player_config = load_module(os.path.join( "save", "config.py")).player_config.copy() self.player.reset() self.player.dead = player_config["dead"] self.player.load_inventory(player_config["inventory"]) self.saved_maps = os.listdir("save") self.current_map = player_config["current_map"] self.player.health = player_config["health"] self.saved_maps = [ os.path.join("maps", x) for x in os.listdir("save/maps") ] self.loaded_maps = {} self.load_map(self.current_map, spawn_pos=player_config["grid_pos"]) if player_config["won"]: self.wingame() elif player_config["lost"]: self.losegame() def load_map(self, path, **kwargs): if path in self.saved_maps: self.saved_maps.remove(path) path = os.path.join("save", path) self.current_map = None if self.current_map: self.loaded_maps[self.current_map] = {} self.loaded_maps[ self.current_map]["floor"] = self.floor.layers.copy() self.loaded_maps[ self.current_map]["obstacles"] = self.obstacles.layers.copy() self.loaded_maps[self.current_map][ "characters"] = self.obstacles.charactermap.copy() self.loaded_maps[self.current_map][ "dead_characters"] = self.obstacles.dead_characters.copy() self.loaded_maps[ self.current_map]["item_map"] = self.obstacles.item_map.copy() self.loaded_maps[ self.current_map]["bullets"] = self.obstacles.bullets.copy() self.loaded_maps[ self.current_map]["triggers"] = self.obstacles.triggers.copy() self.loaded_maps[self.current_map]["config"] = self.config.copy() if path.startswith("save"): self.current_map = path[5:] else: self.current_map = path if path in self.loaded_maps: self.floor.layers = self.loaded_maps[path]["floor"].copy() self.obstacles.layers = self.loaded_maps[path]["obstacles"].copy() self.obstacles.charactermap = self.loaded_maps[path][ "characters"].copy() self.obstacles.dead_characters = self.loaded_maps[path][ "dead_characters"].copy() self.obstacles.item_map = self.loaded_maps[path]["item_map"].copy() self.obstacles.bullets = self.loaded_maps[path]["bullets"].copy() self.obstacles.triggers = self.loaded_maps[path]["triggers"].copy() self.config = self.loaded_maps[path]["config"].copy() else: self.floor.load_tilemap(os.path.join(path, "floor.py")) self.obstacles.load_obstaclemap(os.path.join(path, "obstacles.py")) self.obstacles.load_charactermap( os.path.join(path, "characters.py")) self.obstacles.load_item_map(os.path.join(path, "items.py")) self.obstacles.load_triggermap(os.path.join(path, "triggers.py")) self.obstacles.dead_characters = [] self.obstacles.bullets = [] self.config = load_module(os.path.join(path, "config.py")).config.copy() try: pygame.mixer.music.load(self.config.get("music", "Betrayed.ogg")) pygame.mixer.music.play(-1) except: pass if kwargs.get("spawn_pos", None): self.player.grid_pos = kwargs["spawn_pos"].copy() else: self.player.grid_pos = self.config.get("spawn_pos", [0, 0]).copy() self.player.reset() mapsize = self.config.get("level_dimensions", [50, 50]) self.obstacles.change_size(mapsize) self.obstacles.refresh_trigger_quadtree() self.obstacles.refresh_grid() def update(self, event=None): if not self.wongame: screen_size = self.screen.get_size() isox = (self.player.grid_pos[0] - self.player.grid_pos[1]) * (ISOWIDTH // 2) isoy = (self.player.grid_pos[0] + self.player.grid_pos[1]) * (ISOHEIGHT // 2) self.screen_offset = [ screen_size[0] // 2 - isox, screen_size[1] // 2 - isoy ] current_time = pygame.time.get_ticks() self.floor.update(current_time) self.obstacles.update(current_time=current_time, event=event) if event and event.type == KEYDOWN: if event.key == K_F3: self.savegame() elif event.key == K_F4: self.load_game() elif event.key == K_F11: self.show_fps = not self.show_fps def wingame(self): self.wongame = True pygame.mixer.music.load("wingame.ogg") pygame.mixer.music.play(-1) def losegame(self): self.lostgame = True pygame.mixer.music.load("Sad_Piano_3.ogg") pygame.mixer.music.play(-1) def draw(self): self.floor.draw(self.screen_offset) self.obstacles.draw(self.screen_offset) if self.wongame: screen.blit( FONT.render("Congratulations, you won!", True, (255, 255, 255)), (0, 0)) elif self.lostgame: screen.blit( FONT.render("Shame be upon you! You lost!", True, (255, 255, 255)), (0, 0)) self.screen.blit( FONT.render("Health: " + str(self.player.health), True, (255, 255, 255)), (self.screen.get_size()[0] - 200, 0)) if self.show_fps: self.screen.blit( FONT.render("FPS: " + str(round(clock.get_fps(), 2)), True, (255, 255, 255)), (self.screen.get_size()[0] - 400, 0))
def build_obj_map_2(): # jump pits with rising fire balls array = [] array = [ ob.Block(x=start + 150, y=ground), ob.Block(x=start + 200, y=ground), ob.Block(x=start + 250, y=ground), ob.Block(x=start + 300, y=ground), ob.Block(x=start + 300, y=ground), ob.Glue(x=start + 350, y=ground - 2 * MAP_UNIT_Y), ob.Glue(x=start + 350, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 400, y=ground), ob.Block(x=start + 400, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 400, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 450, y=ground), ob.Block(x=start + 450, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 450, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 450, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=start + 800, y=ground), ob.Block(x=start + 800, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 800, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 800, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=start + 850, y=ground), ob.Block(x=start + start + 850, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 850, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 850, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=start + 900, y=ground), ob.Block(x=start + 900, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 900, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 900, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=start + 950, y=ground), ob.Block(x=start + 950, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 950, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 950, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=start + 1300, y=ground - 10), ob.Block(x=start + 1350, y=ground - 10), ob.Block(x=start + 1700, y=ground - 10), ob.Block(x=start + 1750, y=ground - 10), ob.Block(x=start + 1800, y=ground - 10), ob.Block(x=start + 1850, y=ground - 10), # floor ob.Floor(x=0, y=ground, sizex=500 + 40 * MAP_UNIT_X, sizey=20), # ob.Floor(x= 800, y=ground, sizex=8*MAP_UNIT_Y, sizey=20), # ob.Floor(x= 1300, y=ground, sizex=4*MAP_UNIT_Y, sizey=20), ob.Floor(x=start + 1900, y=ground, sizex=1000, sizey=20), # pit flame 1 ob.Flame(x=start + 500, y=ground), ob.Flame(x=start + 550, y=ground), ob.Flame(x=start + 600, y=ground), ob.Flame(x=start + 650, y=ground), ob.Flame(x=start + 700, y=ground), ob.Flame(x=start + 750, y=ground), # pit flame 2 ob.Flame(x=start + 1000, y=ground), ob.Flame(x=start + 1050, y=ground), ob.Flame(x=start + 1100, y=ground), ob.Flame(x=start + 1150, y=ground), ob.Flame(x=start + 1200, y=ground), ob.Flame(x=start + 1250, y=ground), # pit flame 3 ob.Flame(x=start + 1400, y=ground), ob.Flame(x=start + 1450, y=ground), # moving flame ob.Flame_UFO(x=start + 625, y=ground - 14 * MAP_UNIT_Y), ob.Flame_UFO(x=start + 1125, y=ground - 14 * MAP_UNIT_Y), ob.Flame_UFO(x=start + 1525, y=ground - 14 * MAP_UNIT_Y), ob.Flame_UFO(x=start + 1625, y=ground, speed_y=-0.32 * MAP_UNIT_Y), # low ceiling ob.Floor(x=start + 2000, y=ground - 90, sizex=8 * MAP_UNIT_Y, sizey=20), # vertical tunnel ob.Floor(x=start + 2200, y=0, sizex=20, sizey=400), ob.Flame_Move(x=start + 2200, y=ground - 40, speed_y=9), ob.Flame_Move(x=start + 2300, y=ground - 2 * MAP_UNIT_Y, speed_y=9), ob.Flame_Move(x=start + 2400, y=ground - 2 * MAP_UNIT_Y, speed_y=9) ] return array
def build_obj_map(): array = [] array = [ ob.Block(x=start + 4 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 8 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 12 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), # ob.Flame(x=start-500, y=ground -50), # ob.Flame(x=start + 600, y=ground, size=100), # ob.Flame(x=start + 800, y=ground), ob.Block(x=start + 36 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 40 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 48 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 56 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 64 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 10 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 14 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 18 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 22 * MAP_UNIT_X, y=ground, sizex=4 * MAP_UNIT_Y, sizey=100), ob.Block(x=start + 0.8 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 3.2 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 22.8 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 22.8 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 22.8 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 22.8 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 22.8 * MAP_UNIT_X, y=ground - 8 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 18 * MAP_UNIT_X, y=0, sizex=30), ob.Block(x=start + 18 * MAP_UNIT_X, y=2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 18 * MAP_UNIT_X, y=4 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 18 * MAP_UNIT_X, y=6 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 12 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 12 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), # ob.Flame(x=start + 500, y=ground - 2*MAP_UNIT_Y), # ob.Flame(x=start + 600, y=ground, size=100), # ob.Flame(x=start + 800, y=ground), ob.Block(x=start + 36 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 44 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 52 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 31.2 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 28 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 14 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 18 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 22 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 26 * MAP_UNIT_X, y=ground, sizex=4 * MAP_UNIT_Y, sizey=100), ob.Block(x=start + 0.8 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 3.2 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 12 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 12 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 12 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 12 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 12 * MAP_UNIT_X, y=ground - 8 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 6 * MAP_UNIT_X, y=0, sizex=30), ob.Block(x=start + 6 * MAP_UNIT_X, y=2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 6 * MAP_UNIT_X, y=4 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 6 * MAP_UNIT_X, y=6 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 12 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 16 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), # ob.Flame(x=start + 500, y=ground - 2*MAP_UNIT_Y), # ob.Flame(x=start + 600, y=ground, size=100), # ob.Flame(x=start + 800, y=ground), ob.Block(x=start + 40 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 44 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 52 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 60 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 68 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 94 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 98 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 102 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 106 * MAP_UNIT_X, y=ground, sizex=4 * MAP_UNIT_Y, sizey=100), ob.Block(x=start + 84.4 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 108.4 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 72 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 72 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 72 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 72 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 72 * MAP_UNIT_X, y=ground - 8 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 70 * MAP_UNIT_X, y=0, sizex=30), ob.Block(x=start + 70 * MAP_UNIT_X, y=2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 70 * MAP_UNIT_X, y=4 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 70 * MAP_UNIT_X, y=6 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 52 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 56 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), # ob.Flame(x=start + 500, y=ground - 2*MAP_UNIT_Y), # ob.Flame(x=start + 600, y=ground, size=100), # ob.Flame(x=start + 800, y=ground), ob.Block(x=start + 52, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 44, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=start + 52, y=ground - 220), ob.Flame(x=start + 1780, y=ground - 2 * MAP_UNIT_Y), ob.Flame(x=start + 1700, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 1350, y=ground - 130), ob.Block(x=start + 1650, y=ground - 120), ob.Block(x=start + 850, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 950, y=ground, sizex=4 * MAP_UNIT_Y, sizey=100), ob.Block(x=start + 920, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 980, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=start + 1300, y=ground - 2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 1300, y=ground - 2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 1300, y=ground - 4 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 1300, y=ground - 6 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 1300, y=ground - 8 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 1150, y=0, sizex=30), ob.Block(x=start + 1150, y=2 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 1150, y=4 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 1150, y=6 * MAP_UNIT_Y, sizex=30), ob.Block(x=start + 850, y=ground - 8 * MAP_UNIT_Y, sizex=8 * MAP_UNIT_Y, sizey=20), ob.Floor(x=100, y=ground, sizex=4000, sizey=20), ob.Floor(x=100, y=-20, sizex=4000, sizey=20), ob.Glue(x=start - 2 * MAP_UNIT_Y, y=ground - 2 * MAP_UNIT_Y), ob.Glue(x=start - 450, y=ground - 2 * MAP_UNIT_Y), ob.Glue(x=start - 100, y=ground - 4 * MAP_UNIT_Y), ob.Glue(x=start - 100, y=ground - 6 * MAP_UNIT_Y) ] return array
def build_obj_map_level_3(): #snow level 1 array = [] array = [ ob.Floor(x=MAP_UNIT_X * 2, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 32, sizey=MAP_UNIT_Y * 20), ob.Block_Snow(x=MAP_UNIT_X * 2, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 4, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 6, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 8, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 10, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 12, y=ground - MAP_UNIT_Y * 6), ob.Coin(x=12 * MAP_UNIT_X, y=ground - 8 * MAP_UNIT_Y), ob.Block_Snow(x=MAP_UNIT_X * 14, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 16, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 18, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 20, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 22, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 24, y=ground - MAP_UNIT_Y * 6), ob.Coin(x=24 * MAP_UNIT_X, y=ground - 8 * MAP_UNIT_Y), ob.Block_Snow(x=MAP_UNIT_X * 26, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 28, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 30, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 32, y=ground - MAP_UNIT_Y * 6), ob.Block_Corner3_Snow(x=MAP_UNIT_X * 32, y=ground - MAP_UNIT_Y * 6), ob.Block_Corner4_Snow(x=MAP_UNIT_X * 32, y=ground - MAP_UNIT_Y * 4), ob.Floor(x=MAP_UNIT_X * 70, y=ground - MAP_UNIT_Y * 16, sizex=MAP_UNIT_X * 4, sizey=MAP_UNIT_Y * 6), ob.Floor(x=MAP_UNIT_X * 36, y=ground - MAP_UNIT_Y * 8, sizex=MAP_UNIT_X * 4, sizey=MAP_UNIT_Y * 8), ob.Floor(x=MAP_UNIT_X * 42, y=ground - MAP_UNIT_Y * 12, sizex=MAP_UNIT_X * 4, sizey=MAP_UNIT_Y * 24), ob.Floor(x=MAP_UNIT_X * 48, y=ground - MAP_UNIT_Y * 16, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_Y * 24), ob.Block_Corner_Snow(x=MAP_UNIT_X * 36, y=ground - MAP_UNIT_Y * 10), ob.Block_Corner3_Snow(x=MAP_UNIT_X * 38, y=ground - MAP_UNIT_Y * 10), ob.Block_Corner2_Snow(x=MAP_UNIT_X * 36, y=ground - MAP_UNIT_Y * 8), ob.Block_Corner4_Snow(x=MAP_UNIT_X * 38, y=ground - MAP_UNIT_Y * 8), ob.Block_Corner_Snow(x=MAP_UNIT_X * 42, y=ground - MAP_UNIT_Y * 14), ob.Block_Corner3_Snow(x=MAP_UNIT_X * 44, y=ground - MAP_UNIT_Y * 14), ob.Block_Corner2_Snow(x=MAP_UNIT_X * 42, y=ground - MAP_UNIT_Y * 12), ob.Block_Corner4_Snow(x=MAP_UNIT_X * 44, y=ground - MAP_UNIT_Y * 12), ob.Block_Corner_Snow(x=MAP_UNIT_X * 48, y=ground - MAP_UNIT_Y * 18), ob.Block_Corner2_Snow(x=MAP_UNIT_X * 48, y=ground - MAP_UNIT_Y * 16), ob.Block_Snow(x=MAP_UNIT_X * 50, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 52, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 54, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 56, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 58, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 60, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 62, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 64, y=ground - MAP_UNIT_Y * 18), ob.Block_Fall(x=MAP_UNIT_X * 66, y=ground - MAP_UNIT_Y * 18), ob.Block_Fall(x=MAP_UNIT_X * 68, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 70, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 72, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 62, y=ground - MAP_UNIT_Y * 12), ob.Block_Snow(x=MAP_UNIT_X * 64, y=ground - MAP_UNIT_Y * 12), ob.Block_Snow(x=MAP_UNIT_X * 54, y=ground - MAP_UNIT_Y * 12), ob.Coin(x=54 * MAP_UNIT_X, y=ground - 14 * MAP_UNIT_Y), ob.Block_Snow(x=MAP_UNIT_X * 56, y=ground - MAP_UNIT_Y * 12), ob.Block_Snow(x=MAP_UNIT_X * 58, y=ground - MAP_UNIT_Y * 12), ob.Block_Snow(x=MAP_UNIT_X * 64, y=ground - MAP_UNIT_Y * 12), ob.Block_Snow(x=MAP_UNIT_X * 66, y=ground - MAP_UNIT_Y * 12), ob.Block_Snow(x=MAP_UNIT_X * 68, y=ground - MAP_UNIT_Y * 12), ob.Block_Snow(x=MAP_UNIT_X * 60, y=ground - MAP_UNIT_Y * 12), ob.Block_Fall(x=MAP_UNIT_X * 50, y=ground - MAP_UNIT_Y * 12), ob.Block_Fall(x=MAP_UNIT_X * 52, y=ground - MAP_UNIT_Y * 12), ob.Block_Snow(x=MAP_UNIT_X * 50, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 52, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 54, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 56, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 58, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 60, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 62, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 64, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 66, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 68, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 70, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 72, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 74, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 76, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 78, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 80, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 82, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 84, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 86, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 88, y=ground - MAP_UNIT_Y * 8), ob.Block_Snow(x=MAP_UNIT_X * 92, y=ground - MAP_UNIT_Y * 18), ob.Block_Snow(x=MAP_UNIT_X * 118, y=ground - MAP_UNIT_Y * 18), ob.Floor(x=MAP_UNIT_X * 50, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 40, sizey=MAP_UNIT_Y * 24), ob.Floor(x=MAP_UNIT_X * 90, y=ground - MAP_UNIT_Y * 16, sizex=MAP_UNIT_X * 6, sizey=MAP_UNIT_Y * 24), ob.Floor(x=MAP_UNIT_X * 116, y=ground - MAP_UNIT_Y * 16, sizex=MAP_UNIT_X * 6, sizey=MAP_UNIT_Y * 24), ob.Block_Corner_Snow(x=MAP_UNIT_X * 90, y=ground - MAP_UNIT_Y * 18), ob.Block_Corner2_Snow(x=MAP_UNIT_X * 90, y=ground - MAP_UNIT_Y * 16), ob.Block_Corner3_Snow(x=MAP_UNIT_X * 94, y=ground - MAP_UNIT_Y * 18), ob.Block_Corner4_Snow(x=MAP_UNIT_X * 94, y=ground - MAP_UNIT_Y * 16), ob.Block_Corner_Snow(x=MAP_UNIT_X * 116, y=ground - MAP_UNIT_Y * 18), ob.Block_Corner2_Snow(x=MAP_UNIT_X * 116, y=ground - MAP_UNIT_Y * 16), ob.Block_Corner3_Snow(x=MAP_UNIT_X * 120, y=ground - MAP_UNIT_Y * 18), ob.Block_Corner4_Snow(x=MAP_UNIT_X * 120, y=ground - MAP_UNIT_Y * 16), ob.Floor(x=MAP_UNIT_X * 122, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 32, sizey=MAP_UNIT_Y * 20), ob.Block_Snow(x=MAP_UNIT_X * 122, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 124, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 126, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 128, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 130, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 132, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 134, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 136, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 138, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 140, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 142, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 144, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 146, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 148, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 150, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 152, y=ground - MAP_UNIT_Y * 6), ob.Block_Snow(x=MAP_UNIT_X * 154, y=ground - MAP_UNIT_Y * 6), ] return array
def build_obj_map_level_2(): #level 2 array = [] array = [ ob.Floor(x=MAP_UNIT_X * 2, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 32), ob.Floor(x=MAP_UNIT_X * 24, y=ground - MAP_UNIT_Y * 4, sizex=MAP_UNIT_X * 2), ob.Floor(x=MAP_UNIT_X * 26, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 4, sizey=MAP_UNIT_Y * 4), ob.Floor(x=MAP_UNIT_X * 28, y=ground - MAP_UNIT_Y * 8, sizex=MAP_UNIT_X * 6, sizey=MAP_UNIT_Y * 6), ob.Block_Move(x=MAP_UNIT_X * 48, y=ground - MAP_UNIT_Y * 8), ob.Block_Move(x=MAP_UNIT_X * 52, y=ground - MAP_UNIT_Y * 12), ob.Floor(x=MAP_UNIT_X * 56, y=ground - MAP_UNIT_Y * 16, sizex=MAP_UNIT_X * 12, sizey=MAP_UNIT_Y * 16), ob.Floor(x=MAP_UNIT_X * 72, y=ground - MAP_UNIT_Y * 26, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_Y * 20), ob.Floor(x=MAP_UNIT_X * 68, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 12, sizey=MAP_UNIT_Y * 16), ob.Floor(x=MAP_UNIT_X * 78, y=ground - MAP_UNIT_Y * 16, sizex=MAP_UNIT_X * 12, sizey=MAP_UNIT_Y * 16), ob.Block_Fall(x=MAP_UNIT_X * 90, y=ground - MAP_UNIT_Y * 16), ob.Block_Fall(x=MAP_UNIT_X * 92, y=ground - MAP_UNIT_Y * 16), ob.Floor(x=MAP_UNIT_X * 94, y=ground - MAP_UNIT_Y * 24, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_Y * 10), ob.Floor(x=MAP_UNIT_X * 100, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 20, sizey=MAP_UNIT_Y * 16), ob.Block_Move(x=MAP_UNIT_X * 124, y=ground - MAP_UNIT_Y * 12), ob.Block_Move(x=MAP_UNIT_X * 130, y=ground - MAP_UNIT_Y * 16), ob.Block_Move(x=MAP_UNIT_X * 124, y=ground - MAP_UNIT_Y * 18), ob.Floor(x=MAP_UNIT_X * 126, y=ground - MAP_UNIT_Y * 6, sizex=MAP_UNIT_X * 20, sizey=MAP_UNIT_Y * 12), #graphic objects ob.Block(x=MAP_UNIT_X * 2, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 4, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 6, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 8, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 10, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 12, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 14, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 16, y=ground - MAP_UNIT_Y * 2), ob.Coin(x=16 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=MAP_UNIT_X * 18, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 20, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 22, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 30, y=ground - MAP_UNIT_Y * 8), ob.Block(x=MAP_UNIT_X * 32, y=ground - MAP_UNIT_Y * 8), ob.Block_Corner(x=MAP_UNIT_X * 24, y=ground - MAP_UNIT_Y * 4), ob.Block_Corner(x=MAP_UNIT_X * 26, y=ground - MAP_UNIT_Y * 6), ob.Block_Corner(x=MAP_UNIT_X * 28, y=ground - MAP_UNIT_Y * 8), ob.Block_Corner2(x=MAP_UNIT_X * 24, y=ground - MAP_UNIT_Y * 2), ob.Block_Corner2(x=MAP_UNIT_X * 26, y=ground - MAP_UNIT_Y * 4), ob.Block_Corner2(x=MAP_UNIT_X * 28, y=ground - MAP_UNIT_Y * 6), ob.Block_Corner(x=MAP_UNIT_X * 56, y=ground - MAP_UNIT_Y * 16), ob.Block_Corner2(x=MAP_UNIT_X * 56, y=ground - MAP_UNIT_Y * 14), ob.Block_Corner3(x=MAP_UNIT_X * 32, y=ground - MAP_UNIT_Y * 8), ob.Block_Corner4(x=MAP_UNIT_X * 32, y=ground - MAP_UNIT_Y * 6), ob.Block(x=MAP_UNIT_X * 58, y=ground - MAP_UNIT_Y * 16), ob.Block(x=MAP_UNIT_X * 60, y=ground - MAP_UNIT_Y * 16), ob.Block(x=MAP_UNIT_X * 62, y=ground - MAP_UNIT_Y * 16), ob.Block(x=MAP_UNIT_X * 64, y=ground - MAP_UNIT_Y * 16), ob.Block_Corner3(x=MAP_UNIT_X * 66, y=ground - MAP_UNIT_Y * 16), ob.Block_Corner4(x=MAP_UNIT_X * 66, y=ground - MAP_UNIT_Y * 14), ob.Block(x=MAP_UNIT_X * 68, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 70, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 72, y=ground - MAP_UNIT_Y * 2), ob.Block(x=MAP_UNIT_X * 74, y=ground - MAP_UNIT_Y * 2), ob.Coin(x=74 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=MAP_UNIT_X * 76, y=ground - MAP_UNIT_Y * 2), ob.Block_Corner(x=MAP_UNIT_X * 78, y=ground - MAP_UNIT_Y * 16), ob.Block_Corner2(x=MAP_UNIT_X * 78, y=ground - MAP_UNIT_Y * 14), ob.Block(x=MAP_UNIT_X * 80, y=ground - MAP_UNIT_Y * 16), ob.Block(x=MAP_UNIT_X * 82, y=ground - MAP_UNIT_Y * 16), ob.Block(x=MAP_UNIT_X * 84, y=ground - MAP_UNIT_Y * 16), ob.Block(x=MAP_UNIT_X * 86, y=ground - MAP_UNIT_Y * 16), ob.Block_Corner3(x=MAP_UNIT_X * 88, y=ground - MAP_UNIT_Y * 16), ob.Block_Corner4(x=MAP_UNIT_X * 88, y=ground - MAP_UNIT_Y * 14), ob.Coin(x=88 * MAP_UNIT_X, y=ground - 18 * MAP_UNIT_Y), ob.Block_Corner(x=MAP_UNIT_X * 100, y=ground - MAP_UNIT_Y * 6), ob.Block_Corner2(x=MAP_UNIT_X * 100, y=ground - MAP_UNIT_Y * 4), ob.Block(x=MAP_UNIT_X * 102, y=ground - MAP_UNIT_Y * 6), ob.Block(x=MAP_UNIT_X * 104, y=ground - MAP_UNIT_Y * 6), ob.Block(x=MAP_UNIT_X * 106, y=ground - MAP_UNIT_Y * 6), ob.Block(x=MAP_UNIT_X * 108, y=ground - MAP_UNIT_Y * 6), ob.Block(x=MAP_UNIT_X * 110, y=ground - MAP_UNIT_Y * 6), ob.Block(x=MAP_UNIT_X * 112, y=ground - MAP_UNIT_Y * 6), ob.Block(x=MAP_UNIT_X * 114, y=ground - MAP_UNIT_Y * 6), ob.Block(x=MAP_UNIT_X * 116, y=ground - MAP_UNIT_Y * 6), ob.Block_Corner3(x=MAP_UNIT_X * 118, y=ground - MAP_UNIT_Y * 6), ob.Block_Corner4(x=MAP_UNIT_X * 118, y=ground - MAP_UNIT_Y * 4), ob.Block_Point(x=MAP_UNIT_X * 72, y=ground - MAP_UNIT_Y * 6), ob.Coin(x=72 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block_Point(x=MAP_UNIT_X * 94, y=ground - MAP_UNIT_Y * 14), ] return array
def build_obj_map_tutorial(): array = [] array = [ ob.UFO_Steal(x=10 * MAP_UNIT_X, y=ground - 16 * MAP_UNIT_Y, sizex=MAP_UNIT_X * 8, sizey=MAP_UNIT_Y * 8), ob.Text_Graphic_1(x=6 * MAP_UNIT_X, y=ground - 16 * MAP_UNIT_Y, sizex=MAP_UNIT_X * 4, sizey=MAP_UNIT_Y * 4), ob.Text_Graphic_2(x=2 * MAP_UNIT_X, y=ground - 8 * MAP_UNIT_Y, sizex=MAP_UNIT_X * 4, sizey=MAP_UNIT_Y * 4), ob.Text_Graphic_3(x=30 * MAP_UNIT_X, y=ground - 16 * MAP_UNIT_Y, sizex=MAP_UNIT_X * 4, sizey=MAP_UNIT_Y * 4), ob.Coin(x=6 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=2 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=4 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=6 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=8 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=10 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=12 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=14 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=16 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=18 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=20 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=22 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=24 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=26 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=28 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=30 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=32 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=34 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=36 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=38 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Coin(x=38 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=40 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=42 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), # stairs ob.Block(x=44 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=46 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=46 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), # flat floor ob.Block(x=48 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=48 * MAP_UNIT_X, y=ground - 2 * MAP_UNIT_Y), ob.Block(x=50 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=50 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=52 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=52 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=54 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=54 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=56 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=56 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=58 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=58 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Coin(x=58 * MAP_UNIT_X, y=ground - 8 * MAP_UNIT_Y), # pitfall #ob.Block(x=62 * MAP_UNIT_X, y=14 * MAP_UNIT_Y, sizey=4 * MAP_UNIT_Y), #ob.Block(x=62 * MAP_UNIT_X, y=10 * MAP_UNIT_Y, sizey=4 * MAP_UNIT_Y), #ob.Block(x=62 * MAP_UNIT_X, y=6 * MAP_UNIT_Y, sizey=4 * MAP_UNIT_Y), #ob.Block(x=62 * MAP_UNIT_X, y=4, sizey=4 * MAP_UNIT_Y), ob.Block(x=66 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=66 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=68 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=68 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=70 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=70 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), # flat floor v2 ob.Block(x=72 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=72 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=74 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=74 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=76 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=76 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=78 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=78 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=80 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=80 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=82 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=82 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=84 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=84 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), # Moving block gap ob.Block_Move(x=94 * MAP_UNIT_X, y=ground - 8 * MAP_UNIT_Y), ob.Block(x=100 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=100 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=102 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=104 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), # flat floor v3 ob.Block(x=106 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=106 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=108 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=108 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=110 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=110 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=112 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=112 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=114 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=114 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=116 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=116 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), # falling block section ob.Block_Fall(x=118 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block_Fall(x=120 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block_Fall(x=122 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block_Fall(x=124 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Coin(x=124 * MAP_UNIT_X, y=ground - 8 * MAP_UNIT_Y), ob.Block_Fall(x=126 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block_Fall(x=128 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), # flat floor v4 ob.Block(x=130 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=130 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=132 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=132 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=134 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=134 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=136 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=136 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=138 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=138 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=140 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=140 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=142 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=142 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=144 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=144 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), ob.Block(x=146 * MAP_UNIT_X, y=ground - 4 * MAP_UNIT_Y), ob.Block(x=146 * MAP_UNIT_X, y=ground - 6 * MAP_UNIT_Y), # level floors ob.Floor(x=0, y=ground, sizex=86 * MAP_UNIT_X, sizey=int(0.8 * MAP_UNIT_Y)), ob.Floor(x=104 * MAP_UNIT_X, y=ground, sizex=14 * MAP_UNIT_X, sizey=int(0.8 * MAP_UNIT_Y)), ob.Floor(x=130 * MAP_UNIT_X, y=ground, sizex=80 * MAP_UNIT_X, sizey=int(0.8 * MAP_UNIT_Y)), ob.Floor(x=MAP_UNIT_X * 44, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 116, sizey=MAP_UNIT_Y * 2), ob.Floor(x=MAP_UNIT_X * 46, y=ground - MAP_UNIT_Y * 4, sizex=MAP_UNIT_X * 14, sizey=MAP_UNIT_Y * 4), ob.Floor(x=MAP_UNIT_X * 32, y=ground - MAP_UNIT_Y * 2, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_Y * 2), ob.Floor(x=MAP_UNIT_X * 66, y=ground - MAP_UNIT_Y * 4, sizex=MAP_UNIT_X * 20, sizey=MAP_UNIT_Y * 4), ob.Floor(x=MAP_UNIT_X * 62, y=ground - MAP_UNIT_Y * 26, sizex=MAP_UNIT_X * 2, sizey=MAP_UNIT_Y * 22), ob.Floor(x=MAP_UNIT_X * 100, y=ground - MAP_UNIT_Y * 4, sizex=MAP_UNIT_X * 18, sizey=MAP_UNIT_Y * 14), ob.Floor(x=MAP_UNIT_X * 130, y=ground - MAP_UNIT_Y * 4, sizex=MAP_UNIT_X * 18, sizey=MAP_UNIT_Y * 14), ] return array