Advertisement
CRISPYrice

Doodle God

Feb 7th, 2016
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.05 KB | None | 0 0
  1. ### Create a puzzle game based off Doodle God ###
  2.  
  3. strMyElements = ""
  4.  
  5. tierOne = ["Fire","Water","Air","Earth"] # Tier One is the first lot of elements #
  6. recipes = {"FireEarth":"Lava","FireWater":"Steam","WaterAir":"Clouds","LavaWater":"Stone",
  7.            "WaterEarth":"Sand","FireSand":"Glass","CloudsAir":"Wind","WindSand":"Desert",
  8.            "FireAir":"Energy","WaterFire":"Alcohol","AlcoholEnergy":"Life","EarthLife":"Seeds",
  9.            "SeedsEarth":"Sapling","SaplingTime":"Tree","SaplingEarth":"Grass","GrassStone":"Time"}
  10.  
  11. myElements = tierOne # myElements is the elements that the player has discovered #
  12.  
  13. noElements = 0
  14.  
  15. def combine():
  16.     global myElements
  17.     global strMyElements
  18.     global recipes
  19.     global noElements
  20.     correct = 0
  21.     correct2 = 0
  22.  
  23.     ### This is the achievement area ###
  24.    
  25.     if noElements == 10:
  26.         input("\n...")
  27.         input("\nYou have discovered 10 Elements!")
  28.         input('''"God does not play dice with the universe...
  29. Unless he can program in python, then all he has to do is import random!"
  30.  
  31. - Albert Einstein (revised)\n''')
  32.     if noElements == 20:
  33.         input("\n...")
  34.         input("\nYou have discovered 20 Elements!")
  35.         input('''"Because tonight! Tonight is gonna be:
  36. Legend... Wait for it... Dary!!!"
  37.  
  38. - Barney Stinsen (I think...)\n''')
  39.     if noElements == 30:
  40.         input("\n...")
  41.         input("\nYou have discovered 30 Elements!")
  42.         input('''"Have you tried turning it off and on again?"
  43.  
  44. - Roy Trenneman (IT Crowd)\n''')
  45.    
  46.     ### This code is for showing the player what elements they have discovered ###
  47.  
  48.     print("You have discovered " + str(noElements) + " elements!")
  49.     print("\nThe elements that you have discovered are:\n" + str(myElements))
  50.  
  51.     ### Ask the player to try combining elements ###
  52.    
  53.     combo1 = input("\nSelect the first element from the list to combine >> ")
  54.     for i in myElements:
  55.         scanElement = str(i)
  56.         if combo1.lower() == scanElement.lower(): # If you have the element you want to combine #
  57.             correct = 1
  58.             break
  59.     if correct == 0: # If you don't #
  60.         input("You need to have discovered the element to use it!")
  61.         combine()
  62.  
  63.     ### Repeat for combo2 ###
  64.    
  65.     combo2 = input("Select the second element from the list to combine >> ")
  66.     for i in myElements:
  67.         scanElement = str(i)
  68.         if combo2.lower() == scanElement.lower():
  69.             correct2 = 1
  70.             break
  71.     if correct2 == 0:
  72.         input("You need to have discovered the element to use it!")
  73.         combine()
  74.        
  75.     for i in recipes:
  76.         if combo1.lower() + combo2.lower() == i.lower(): # Check if it's a recipe
  77.             input("You made " + recipes[i] + "!")
  78.             newElement = str(recipes[i])
  79.             if newElement not in myElements:
  80.                 noElements = noElements + 1
  81.                 myElements.append(newElement) # Add the newly discovered element to myElements #
  82.         elif combo2.lower() + combo1.lower() == i.lower():
  83.             input("You made " + recipes[i] + "!")
  84.             newElement = str(recipes[i])
  85.             if newElement not in myElements:
  86.                 noElements = noElements + 1
  87.                 myElements.append(newElement)
  88.     combine()
  89.    
  90. combine()
  91.  
  92.  
  93.  
  94. ###   NOTES:
  95. ###
  96. ### - This code uses a single function. I didn't use it like a function
  97. ###   and I know that this can cause problems but... Who cares? (Probably me in a week)
  98. ### - When the game prints the Elements that you have discovered, it prints the entire
  99. ###   array. This doesn't look as nice as printing each Element independantly but I got
  100. ###   lazy...
  101. ### - The code should probably tell you that your reaction did nothing. But, once again,
  102. ###   I'm lazy
  103. ### - The code has been written in such a way that you can add as many new Elements and
  104. ###   combinations later if you think the game is too easy to complete
  105. ### - I have set up an in-game achievement system. It tells you that you've reached a
  106. ###   certain milestone and gives you a quote when you do
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement