gui = GUI(400,400,'Battle Tanks') grid = Grid(16,16) BaseClass.grid = grid BaseClass.gui = gui BaseClass.images = imageloader done = False process_stage = 0 player = Tank(40,40) player_sequence = [player] render_sequence = [grid] grid.Draw('park2') grid.sortRenderingComponents() def stage(n): global gui for e in gui.event(): if e.type == pygame.QUIT: return -1 if e.type == pygame.VIDEORESIZE: gui.resize(e.dict['size'][0],e.dict['size'][1]) if n == 0: dx = pygame.mouse.get_pos()[0] - player.x dy = pygame.mouse.get_pos()[1] - player.y rad_angle_turret = math.atan2(dx,dy)
if floor > 0 and floor % x == 0: colCount += 2 rowCount += 2 #TODO: startCell and endCell should be shifted. Goal being to keep the center point in the center rather than growing towards, for eg, the north-east endCell = (endCell[0] + 1, endCell[1] + 1) grid = Grid(colCount, rowCount) if floor > 0: startCell = endCell Algorithm.On(grid, startCell) #TODO: endCell should be a dead end from the current grid, preferably far away from startCell endCell = grid.randomDeadend().coord() while endCell == startCell: endCell = grid.randomDeadend().coord() grid[startCell].content = "S" grid[endCell].content = "E" Clear() print("Floor " + str(floor)) print(grid) grid.Draw("output/Floor_" + str(floor)) i = input("Press enter for next floor, or type 'exit' to quit: ") if i == "exit": run = False floor += 1