本文整理汇总了Python中Client.send_loc方法的典型用法代码示例。如果您正苦于以下问题:Python Client.send_loc方法的具体用法?Python Client.send_loc怎么用?Python Client.send_loc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client.send_loc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Client [as 别名]
# 或者: from Client import send_loc [as 别名]
def main():
setrecursionlimit(3500)
#Window
SCREEN_W = 91
SCREEN_H = 61
LIMIT_FPS = 30
#Make Libtcod Available
print("Instantiating libtcod")
libtcod.console_set_custom_font('arial10x10.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD)
libtcod.console_init_root(SCREEN_W, SCREEN_H, 'Eoraldil', False)
libtcod.sys_set_fps(LIMIT_FPS)
con = libtcod.console_new(SCREEN_W, SCREEN_H)
#Default Character fill in
player = Player("Lorinthio")
#player = Player("Phrixious")
player.createPlayer()
player.equipClass("Warrior")
local_map_objects = []
local_mobs = {}
#GUI
mouse = libtcod.Mouse()
key = libtcod.Key()
gui = GUIHandler(player)
gui.update()
libtcod.console_flush()
#Generates the map
local_map = Map(gui, "fullmap")
(startx, starty) = local_map.starting_point
#Sets player to the location given from the starting point
player.x = startx
player.y = starty
local_players = [player]
#FOV
FOV_ALGO = 0
FOV_LIGHT_WALLS = True
TORCH_RADIUS = 12
fov_map = libtcod.map_new(local_map.width, local_map.height)
for y in range(local_map.height):
for x in range(local_map.width):
libtcod.map_set_properties(fov_map, x, y, not local_map.mappedArea[x][y].block_sight, not local_map.mappedArea[x][y].blocked)
camera = PlayerCamera(player, local_map, fov_map)
#gui.update()
#libtcod.console_flush()
#CLIENT
host = "localhost"
port = "25565"
c = Client(host, int(port), player, gui)
fov_recompute = True
#music = thread.start_new_thread(play_music, ('forest',))
timer = Timer()
frame = 0
while not libtcod.console_is_window_closed():
libtcod.sys_check_for_event(libtcod.EVENT_KEY_PRESS|libtcod.EVENT_MOUSE,key,mouse)
#handle keys and exit game if needed
if fov_recompute:
#recompute FOV if needed (the player moved or something)
fov_recompute = False
libtcod.map_compute_fov(fov_map, player.x, player.y, local_map.fov_range, FOV_LIGHT_WALLS, FOV_ALGO)
c.send_loc = True
c.Loop()
(local_players, local_map_objects, local_mobs) = checkClient(c, local_players, local_map_objects, local_mobs)
#Check if server changed the map, or player changed zones
if c.mapChange:
c.mapChange = False
mapChangeList = []
makeMapFromServer(player, gui, local_map, c, mapChangeList)
local_map = mapChangeList[0]
fov_Map = mapChangeList[1]
fov_recompute = True
fov_map = fov_Map
objects = local_map_objects + local_players
if not fov_recompute:
(exit, fov_recompute, changeMap, fov_Map) = handle_keys(player, local_map, objects, gui, key)
#.........这里部分代码省略.........