Changeset 177


Ignore:
Timestamp:
05/29/12 17:40:09 (3 years ago)
Author:
andefodahl
Message:

Score modification for failed story mode actions

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/story.py

    r171 r177  
    88from gameobject import *
    99from constants import BBUILDER
     10from math import log
    1011import globalVars
    1112
     
    3435       
    3536        levelStatus = self.levelDict[self.currentLevel].update(valueChange)
    36         if levelStatus == "UpdateScore":
    37             self.score += 1000*(self.currentLevel+1)
     37        if levelStatus[0] == "UpdateScore":
     38            adjustment = float(10-levelStatus[1]) / 10.0
     39            self.score += 1000*(self.currentLevel+1+self.difficulty)*(adjustment)
    3840        elif levelStatus == "IncrementLevel":
    3941            self.currentLevel += 1
     
    6466        self.clock = pygame.time.Clock()
    6567        self.background = background
     68        self.mistakes = 0
    6669
    6770    def generatePuzzle(self):
     
    8790        if puzzleComplete == "Score++":
    8891            self.puzzlesCompleted += 1
    89             return "UpdateScore"
     92            mistakes = self.mistakes
     93            self.mistakes = 0
     94            return ("UpdateScore", mistakes)
     95           
     96        if puzzleComplete == False:
     97            self.mistakes += 1
    9098       
    9199        return "None"
     
    102110        """initializes a Puzzle"""
    103111        self.goalNumber = goalNumber
     112        self.binGoalNumber = self.getBinaryNumber()
    104113        self.currentCount = 0
    105114        self.difficulty = difficulty
     
    189198                    self.mode = BBUILDER.END
    190199                return "Score++"
     200            if (valueChange > 0):
     201                bitNumber = int(log(valueChange, 2))
     202                if (bitNumber > len(self.binGoalNumber)-1):
     203                    return False           
     204                elif (self.binGoalNumber[-bitNumber -1] == '0'):
     205                    return False
     206                return True
    191207        if self.mode == BBUILDER.END and self.endText == None:
    192208            return "Next"
     
    291307        globalVars.graphics.drawText(str(self.goalNumber) + " = ", textLeft, 80, 120,
    292308                                     pygame.Color("black"), "left")
    293         strBinaryNum = self.getBinaryNumber()
     309        strBinaryNum = self.binGoalNumber
    294310
    295311        for i in range(len(strBinaryNum)):
  • src/survival.py

    r168 r177  
    4343            self.puzzleMistake = False
    4444        elif (puzzleStatus == False):
     45            print "here"
    4546            self.multiplier = 1
    4647            self.puzzleMistake = True
Note: See TracChangeset for help on using the changeset viewer.