#Unicode characters were obtained from: https://www.compart.com/en/unicode/block/U+2600 characterLocation = [5,5] bag = [] health = 100 money = 10 #Function for displaying the grid and taking a movement command def displayAndMove(): global characterLocation #locations map = [ ["-","-","-","-","-","-"], ["-","-","-","-","-","-"], ["-","-","-","-","-","-"], ["-","-","-","-","-","-"], ["-","-","-","-","-","-"], ["-","-","-","-","-","-"] ] map[characterLocation[0]][characterLocation[1]] = "\u26F9" #Character map[0][3] = "\u26EA" #House map[1][0] = "\u26FA" #Tent map[4][1] = "\u26FD" #Petrol #Line below clears the screen print("\x1b[2J\x1b[H", end="") print("Health:",health) print("Money:",money) print("Bag:",bag) print("\n") for row in map: print(*row, sep=' ') print("\n") movement = input("Which direction would you like to move? (W/S/A/D)").upper() if movement == "W" and characterLocation[0] != 0: characterLocation[0] -= 1 elif movement == "S" and characterLocation[0] != 5: characterLocation[0] += 1 if movement == "A" and characterLocation[1] != 0: characterLocation[1] -= 1 if movement == "D" and characterLocation[1] != 5: characterLocation[1] += 1 mainGameLoop() #One function for each location which runs when you go there on the map def home(): print("You are home") input("") displayAndMove() def tent(): print("You are in the woods") input("") displayAndMove() def petrol(): print("You are at a petrol station") input("") displayAndMove() #The main function which will act as the game loop def mainGameLoop(): if characterLocation == [0,3]: home() elif characterLocation == [1,0]: tent() elif characterLocation == [4,1]: petrol() displayAndMove() mainGameLoop()