So I'm currently writing a roguelike game using only ascii characters, and I can't figure out how to check if there are walls in front of my characters (So ideally whatever method I use returns a '#'). My idea was to check after each move if the character is trying to move into a wall, but I can't find code that lets me check the specific character already printed out in the terminal at an (x, y) location.
Any help would be appreciated! I'm currently using
sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (x, y, text))
to print characters at specific locations.
you need to store you "map" in a 2d array
consider
in this map 1 would be a wall ... 0 is a walkable tile... now as long as you know the X,Y of the target where the character will move... you can tell if you are walking into a wall