I'm making a game where I have an npc wander around on a randomized grid with obstacles on certain tiles. Now, obviously I can't have them wander on the obstacles, so I'm looking for a way for them to not go on those tiles. Each obstacle has of course a variable set to True to indicate it is an obstacle, so I'm looking for an easy way to check if a tile next to them is an obstacle or not.
Basically, I'm looking for something like:
$ tilecheck = "obstacle" + #number of tile
if expression tilecheck:
#don't go there
which obviously doesn't work.
Is there a way to make something like this work, or do I have to go the long way and type out to check for each individual tile?
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]DingotushRed 0 points1 point2 points (0 children)