コード例 #1
0
ファイル: engine.py プロジェクト: m1221/life_of_barold
 def changeMeter(self, meter, value):
   if meter == 'cash':
     self.cash = self.cash + value
     loading.load_string("Cash gained/lost: " + str(value), 70)
     self.displayCash()
   elif meter == 'happy':
     self.happyness = self.happyness + value
     loading.load_string("Happiness gained/lost: " + str(value), 70)
     self.displayHappyness()
   else:
     print "Invalid input. Cash or Happy"
コード例 #2
0
ファイル: engine.py プロジェクト: m1221/life_of_barold
def playDayAndNight(daysEventsList, barry):
  loading.load_string("Welcome to the Life of Barold!", 25)
  loading.load_string("You have happiness, you have cash. Make more cash and get more happy by solving problems at work!",40)
  days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  for i in range(0,7):
    print "----" + days[i] +"----"
    playDay(barry, daysEventsList[i])
    continueGame()
  print "End game stats: "
  barry.displayHappyness()
  barry.displayCash()
コード例 #3
0
ファイル: engine.py プロジェクト: m1221/life_of_barold
 def displayCash(self):
   loading.load_string("Cash : " + str(self.cash), 70)
コード例 #4
0
ファイル: engine.py プロジェクト: m1221/life_of_barold
 def displayHappyness(self):
   loading.load_string("Happyness level : " + str(self.happyness), 70)
コード例 #5
0
ファイル: engine.py プロジェクト: m1221/life_of_barold
def playDay(barry, dayEventValues): # day is an integer value ranging from 0 to 6
  loading.load_string("The start of a new day! You roll out of bed, stretching and yawning, preparing yourself to take on the day, whatever it entails. You are on-call this week, so you should be kept busy.", 200)
  loading.load_string("You sit at your desk and wait for the work to come...", 50)
  loading.loading(1, 3)
  loading.load_string("Event!!\n" + dayEvents[dayEventValues[0]]['name'])
  loading.load_string(dayEvents[dayEventValues[0]]['descrip'], 80)
  loading.load_string("SOLVE THIS PROBLEM: (NO CALCULATORS, USE MENTAL MATH! :-)  )", 20)
  loading.loading(1, 6)
  loading.load_string( dayEventValues[1][0]) # prints math q
  
  answerIsInt = False
  while answerIsInt == False:
    answer = raw_input()
    try:
      answer = int(answer)
      answerIsInt= True
    except:
      print "Please enter an integer"
  
  if int(answer) == dayEventValues[1][1]:
    loading.playSound('woohoo')
    loading.load_string("CORRECT!")
    happyChange = dayEvents[dayEventValues[0]]['passEffect'][1]
    cashChange = dayEvents[dayEventValues[0]]['passEffect'][0]
    barry.changeMeter('cash', cashChange)
    barry.changeMeter('happy', happyChange)
  else:
    loading.playSound('doh')
    loading.load_string("WRONGO!")
    happyChange = dayEvents[dayEventValues[0]]['failEffect'][1]
    cashChange = dayEvents[dayEventValues[0]]['failEffect'][0]
    barry.changeMeter('cash', cashChange)
    barry.changeMeter('happy', happyChange)