Advertisement
DrAungWinHtut

adventure4.py

Mar 26th, 2023 (edited)
694
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.66 KB | None | 0 0
  1. hx = 6
  2. hy = 3
  3.  
  4. sbx1 = 1
  5. sby1 = 3
  6. stx1 = 2
  7. sty1 = 1
  8.  
  9. sbx2 = 1
  10. sby2 = 8
  11. stx2 = 2
  12. sty2 = 6
  13.  
  14. dbx1 = 3
  15. dby1 = 3
  16. dtx1 = 4
  17. dty1 = 1
  18.  
  19. dbx2 = 5
  20. dby2 = 5
  21. dtx2 = 6
  22. dty2 = 1
  23.  
  24. ux = 5
  25. uy = 5
  26.  
  27. ans = 'start'
  28.  
  29. marks = 100
  30.  
  31. print("Game is Starting...")
  32. print("Game Control a-left,d-right,w-up,s-down,q-quit...")
  33. print("Your Starting Position is x={} and y={}".format(ux, uy))
  34. print()
  35. print()
  36.  
  37. while ans != 'q':
  38.  
  39.     ans = input(">>>")
  40.     marks = marks - 1
  41.     if ans == 'a':
  42.         ux = ux - 1
  43.         if ux < 1:
  44.             ux = 1
  45.     elif ans == 'd':
  46.         ux = ux + 1
  47.         if ux > 10:
  48.             ux = 10
  49.     elif ans == 'w':
  50.         uy = uy - 1
  51.         if uy < 1:
  52.             uy = 1
  53.     elif ans == 's':
  54.         uy = uy + 1
  55.         if uy > 10:
  56.             uy = 10
  57.  
  58.     print("Your Current Position is x={} and y={}".format(ux, uy))
  59.  
  60.     if (ux == sbx1) and (uy == sby1):
  61.         ux = stx1
  62.         uy = sty1
  63.         print("Wow Stair!!!!\nYour Current Position is x={} and y={}".format(ux, uy))
  64.  
  65.     elif (ux == sbx2) and (uy == sby2):
  66.         ux = stx2
  67.         uy = sty2
  68.         print("Wow Stair!!!!\nYour Current Position is x={} and y={}".format(ux, uy))
  69.     elif (ux == dtx1) and (uy == dty1):
  70.         ux = dbx1
  71.         uy = dby1
  72.         print("Ahhh Snake!!!!\nYour Current Position is x={} and y={}".format(ux, uy))
  73.     elif (ux == dtx2) and (uy == dty2):
  74.         ux = dbx2
  75.         uy = dby2
  76.         print("Ahhh Snake!!!!\nYour Current Position is x={} and y={}".format(ux, uy))
  77.     elif (ux == hx) and (uy == hy):
  78.         print("Finally, Home Sweet Home!!!")
  79.         print("your mark is {}".format(marks))
  80.         exit()
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement