mi.chunk = (random.randint(0, 1000), random.randint(0, 1000))
wm, hm = 32, 16
mi.world_size = (wm, hm)
mi.set_terrain_type(terrain_medium, colorscale_normal)
mi.max_number_of_roads = random.randint(0, 6)
mi.max_number_of_rivers = random.randint(0, 6)
mi.zoom_cell_sizes = [32, 16]
mi.seed_static_objects = random.randint(0, 1000)
me = mi.configure_map_editor(FPS)  #me = "Map Editor"
img = me.get_hmap_img((wm * 10, hm * 10))
game = Game(me)

#<fast> : quality a bit lower if true, loading time a bit faster.
#<use_beach_tiler>: quality much better if true, loading much slower.
#<load_tilers> : Very slow but needed if you don't have Numpy but still want HQ.
game.build_map(mi, fast=False, use_beach_tiler=True, load_tilers=False)
me.set_zoom(level=0)

##game.set_fire((3,7))
##game.add_smoke("large",(4,4))

clock = pygame.time.Clock()
done = False
while not done:
    clock.tick(FPS)
    screen.fill((0, 0, 0))
    me.cam.draw_grid(screen, show_grid_lines=False)
    me.cam.draw_objects(screen, me.dynamic_objects, draw_ui=False)
    game.refresh_smokes()
    game.t += 1
    me.lm.next_frame()
Beispiel #2
0
humans.finalize() #always call this function to finish initialize a race !!!

humans2 = Race("Red team", "human", SOLAR, me, "red", team=2)
##humans2.base_material_cost["forest"] = 10
##humans2.base_terrain_attack["grass"] = 0.8
humans2.dist_factor = 10
humans2.finalize()

players = [ Player(1, "Helmut", humans),
            Player(2, "Jean", humans2)]
game.set_players(players)

#<fast> : quality a bit lower if true, loading time a bit faster.
#<use_beach_tiler>: quality much better if true, loading much slower. Req. Numpy!
#<load_tilers> : Very slow but needed if you don't have Numpy but still want hi quality.
game.build_map(map_initializer, fast=True, use_beach_tiler=False, load_tilers=False)

##game.add_unit((15,5), humans["infantry"], 100, team=1)
##game.add_unit((14,6), humans["infantry"], 100, team=1) #14,6
##game.add_unit((25,5), humans["infantry"], 100, team=1)
##game.add_unit((16,6), humans["wizard"], 1, team=1)
##
##
##game.add_unit((20,8), humans2["infantry"], 100, team=2)
##game.add_unit((15,7), humans2["infantry"], 100, team=2)
game.add_unit((3,3), humans["wizard"], 10) reste bloque dans le anim path
game.add_unit((4,5), humans["infantry"], 10)
game.add_unit((5,5), humans2["infantry"], 20)
##game.add_unit((13,10), humans["wizard"], 30)
##game.add_unit((14,1), humans2["villager"], 10)
##game.add_unit((12,11), humans2["wizard"], 30)