X-Git-Url: https://plomlompom.com/repos/process?a=blobdiff_plain;f=game_common.py;h=b729a29b82e79818e914b5386b34c32c81dbca14;hb=b7d8d49aaca0cdfd7be583c5da44aa37e9ad693c;hp=689398ddbce3cd85f93e7bcee5cbd1d2ce9e8c0a;hpb=827134a13175939231b85fbc159c013e0f024e78;p=plomrogue2-experiments diff --git a/game_common.py b/game_common.py index 689398d..b729a29 100644 --- a/game_common.py +++ b/game_common.py @@ -25,6 +25,9 @@ class Map: for y in range(self.size[0]): self.terrain += '?' * self.size[1] + def get_position_index(self, yx): + return yx[0] * self.size[1] + yx[1] + class World: @@ -52,7 +55,7 @@ class Thing: self.position = [0,0] -class Commander: +class CommonCommandsMixin: def cmd_MAP_SIZE(self, yx): """Set self.map_size to yx, redraw self.terrain_map as '?' cells."""