Changeset 401


Ignore:
Timestamp:
04/06/2012 08:27:03 PM (3 years ago)
Author:
rthomas
Message:

added win scene and back/forward responses

Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • resources/data/scenes/intro.txt

    r356 r401  
     1main_menu
     2game
    13Welcome to TechTrek! You begin your journey flying through space in your spaceship.
    24Intro-01
  • resources/data/scenes/lose.txt

    r390 r401  
     1main_menu
     2main_menu
    13The pollution levels have rose too high...
    24Lose-01
  • src/font.py

    r395 r401  
    1414
    1515
    16 FONT_NAME = resourceDir + os.sep + "BNEG98.ttf"
     16FONT_NAME = resourceDir + "BNEG98.ttf"
    1717MAX_FONT_SIZE = 100
    1818
  • src/gameData.py

    r378 r401  
    3838
    3939    def analyze(self):
    40         if self.oldState.specs.pollution >= 200:
     40        lose = self.oldState.checkLoseConditions()
     41        if lose[2]:
    4142            self.enqueueScene("lose")
     43       
     44        win = self.oldState.checkWinConditions()
     45        if win:
     46            self.enqueueScene("win")
    4247
    4348    def getMoney(self):
  • src/scene.py

    r378 r401  
    2424        self.currentStill = 0
    2525        self.numStills = 0
     26        self.backResponse = 1
     27        self.forwardResponse = 0
    2628        self.responseFunctions = response
    2729        if DEBUG == 0:
     
    7476            print "next still last"
    7577            self.closeWindow()
    76             self.responseFunctions.pop(0)
     78            self.responseFunctions.pop(self.forwardResponse)
    7779            self.runAddedResponses()
    7880
     
    9193        else:
    9294            self.closeWindow()
    93             self.responseFunctions.pop(1)
     95            self.responseFunctions.pop(self.backResponse)
    9496            self.runAddedResponses()
    9597
     
    138140                return True
    139141        Window.response(self, e)
     142       
     143    def parseResponse(self, response):
     144        print response
     145        if response == "main_menu":
     146            return 1
     147        elif response == "game":
     148            return 0
     149        else:
     150            return 0
     151
     152    def setBackResponse(self, response):
     153        self.backResponse = self.parseResponse(response)
     154   
     155    def setForwardResponse(self, response):
     156        self.forwardResponse = self.parseResponse(response)
    140157
    141158
     
    153170    else:
    154171        scene = Scene((0, 0), True, response)
     172        backResponse = sceneData.readline().rstrip('\n')
     173        scene.setBackResponse(backResponse)
     174       
     175        forwardResponse = sceneData.readline().rstrip('\n')
     176        scene.setForwardResponse(forwardResponse)
     177       
    155178        textLine = sceneData.readline()
    156179        while textLine != "":
     180            print textLine
    157181            img = sceneData.readline()
    158182            img = img.rstrip('\n')
     
    160184            scene.addStill(nextStill)
    161185            textLine = sceneData.readline()
     186
    162187        return scene
Note: See TracChangeset for help on using the changeset viewer.