From 9c346f2749d1e9f63be1421d7d1fe51162bc64e3 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 29 Nov 2015 23:06:07 +0100 Subject: [PATCH] New client: Scroll map window with player avatar. --- client_prototype.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client_prototype.py b/client_prototype.py index 2fc7a44..02f63b9 100644 --- a/client_prototype.py +++ b/client_prototype.py @@ -298,7 +298,16 @@ def win_foo(): def win_map(): + win_size = next(win["size"] for win in windows if win["func"] == win_map) offset = [0, 0] + for i in range(2): + if world_data["position"][i] * (i + 1) > win_size[i] / 2: + if world_data["position"][i] * (i + 1) \ + < world_data["map_size"] * (i + 1) - win_size[i] / 2: + offset[i] = world_data["position"][i] * (i + 1) \ + - int(win_size[i] / 2) + else: + offset[i] = world_data["map_size"] * (i + 1) - win_size[i] + i winmap_size = [world_data["map_size"], world_data["map_size"] * 2 + 1] winmap = [] for y in range(world_data["map_size"]): -- 2.30.2