So i'm trying to have a item in a "map" that is only shown while within one tile and my current solution is not working. The location of the item-crafter (the function of which don't currently need support in) is set with these:
scitemcraft = [random.randint(1, 25), random.randint(0, 24)]
and
while not (1 <= scitemcraft[0] <= 25 and 0 <= scitemcraft[1] <= 24):
scitemcraft = [random.randint(1, 25), random.randint(0, 24)]
this is then shown on the map using the hidden function to determine if it should be "_" or "i" when printed
def hidden():
if abs(pX - scitemcraft[1]) <= 1 and abs(pY - scitemcraft[0]) <= 1:
return 'i'
else:
return '_'
Also, fMap[scitemcraft[0]][scitemcraft[1]] = hidden()
is run before the print is done. Even when i go near the cords printed, the icon is never shown and i can walk through the tile it should be. Any clue why this isn't working or how to fix it? Also, if needed the rest of the code is here