import time import pygame global gold global weapon global armour global health global potion gold = 0 weapon = 0 armour = 0 health = 100 potion = 0 print "Welcome to my test game." time.sleep(0.7) print "In this game your task is to defeat the world of Ergrimar" ou = raw_input("Do you wish to begin Y/N?: ") if ou == "Y": print "Great! Let's begin!" time.sleep(0.7) way1 = raw_input("Now tell me, where do you want to go South/North?: ") if way1 == "South": print "You headed south" time.sleep(1) print "You entered the city Haliman. A guy walks up to you and gives you 50 gold!" gold = 50 time.sleep(0.7) op = raw_input("A little girl walks up to you and asks for a little money. Do you wish to give her 10 gold Y/N?: ") if op == "Y": print "You gave the little girl 10 gold, she gave you an helmet in return. Your armour has been raised to 15!" armour = 15 if op == "N": print "The little girl starts to scream and calls her father over. Her father took all your gold and gave you nothing in return." gold = 0 time.sleep(0.7) pi = raw_input("Do you wish to leave the city or enter a store Leave/Store?: ") if pi == "Store": print "You walked into a store." time.sleep(0.5) store1 = raw_input("Weapon: 15 gold.10 armour: 10 gold. Potion: 5 gold. Do you wish to buy Weapon/Armour/Potion/Cancel?: ") if store1 == "Weapon": print "You received a weapon!" weapon = weapon + 1 if store1 == "Armour": print "You received 10 armour!" armour = armour + 10 if store1 == "Potion": print "You received a potion!" potion = potion + 1 if store1 == "Cancel": print "To bad, you're really going to need some of that." time.sleep(1) yu = raw_input("Do you wish to leave the city or go back to the store and get some more items Store/Leave?: ") if yu == "Store": print "You walked into a store." time.sleep(0.5) store1 = raw_input("Weapon: 15 gold.10 armour: 10 gold. Potion: 5 gold. Do you wish to buy Weapon/Armour/Potion/Cancel?: ") if store1 == "Weapon": print "You received a Weapon!" Weapon = Weapon + 1 if store1 == "Armour": print "You received 10 armour!" armour = armour + 10 if store1 == "Potion": print "You received a potion!" potion = potion + 1 if store1 == "Cancel": print "To bad, you're really going to need some of that." time.sleep(1) print "The store is now closed so you better get going." uu = raw_input("Tell me. Where do you wish to go West/East?: ") if uu == "West": print "You headed west." time.sleep(1) print "A troll comes running towards you" time.sleep(1) rt = raw_input("What do you do Run/Fight?: ") if rt == "Run": print "You got away, I don't recommend your run away because the enemy can sometimes catch you!" if rt == "Fight": if weapon == 1 or 2 or 3 or 4 or 5: print "You killed the troll with your weapon! But it took 15hp of your health!" health = health - 15 if weapon == 0: print "You don't have a weapon, so the troll hit you and took 85hp of your health!" health = health - 85 time.sleep(1) print "You ran away because it was your only option!"
en í endann þegar trollið kemur og eg er ekki með neitt weapon kemur þetta upp:
You headed west.
A troll comes running towards you
What do you do Run/Fight?: Fight
You killed the troll with your sword! But it took 15hp of your health!
You don't have a weapon, so the troll hit you and took 85hp of your health!
You ran away because it was your only option!
er eh sem sér villuna og gæti bent mer a hana ?