Skip to content

Commit

Permalink
added init pos attribute for maps
Browse files Browse the repository at this point in the history
  • Loading branch information
20akshay00 committed Mar 30, 2022
1 parent 67f9434 commit 4cf1ece
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tetra/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(self, filepath, settings, game, pos = None):
self.name = jsonobj["name"]
self.fmt_ref = np.stack([list(elt) for elt in jsonobj["raw"].splitlines()]) #formatted map as np grid
self.r, self.c = self.fmt_ref.shape #map size
self.init_pos = np.array(jsonobj["init_pos"])
self.pos = np.array(jsonobj["init_pos"]) if (pos is None) else pos #player pos
self.items_ref = {tuple(jsonobj["items"][it_name]): it_name for it_name in jsonobj["items"].keys()}
self.exits = jsonobj["exits"] #dict of exit coords and new map
Expand Down

0 comments on commit 4cf1ece

Please sign in to comment.