Advertisement
DrAungWinHtut

advanture.py

Mar 25th, 2023
665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. x = 50
  2. y = 50
  3.  
  4. gx = 58
  5. gy = 10
  6. print('Game is Starting...')
  7. print('Your initial position is x = {}, y = {}'.format(x, y))
  8. while True:
  9.     key = input()
  10.     if key == 'a':
  11.         x -= 1
  12.     elif key == 'd':
  13.         x += 1
  14.     elif key == 'w':
  15.         y -= 1
  16.     elif key == 's':
  17.         y += 1
  18.     print('You moved to x = {}, y = {}'.format(x, y))
  19.     if (x == gx) and (y == gy):
  20.         print("Wow, you found the gold pot!!!")
  21.         exit()
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement