Changeset 96

Show
Ignore:
Timestamp:
03/02/2012 08:29:14 PM (2 years ago)
Author:
ecoughlan
Message:

Backgrounds and block images updated; begin research framework

Location:
src
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • src/block.py

    r92 r96  
    2626        blockMap = Window('blockMap_' + str(self.ID),600,20) 
    2727        blockMap.setDefaultResponse(Response('windows',[],False,True)) 
    28         landscapeArt = pygame.image.load(os.path.abspath(resourceDir + os.sep + "images" + os.sep + "test images" + os.sep + "landscape.png")) 
     28        landscapeArt = pygame.image.load(os.path.abspath(pngDir + "landscapes" + os.sep + "landscape-0" + str(self.ID+1) + ".png")) 
    2929#        if self.ID > 0: 
    3030#            backButton = WindowEntry(('blockMap_' + (self.ID-1),True,False)) 
  • src/buildables.py

    r92 r96  
    1818truckStats.setInit(Spec(100,20,0,-10,0)) 
    1919truckStats.setCont(Spec(0,0,10,0,5)) 
    20 truck = Building('truck', TRANSPORT, truckStats) 
     20truck = Building('truck', TRANSPORT, truckStats, (0,0,0)) 
    2121truck.setMenuDescript("This is a truck") 
    2222truck.setDetailedDescript("This is a detailed description of a truck.") 
     
    2929trainStats.setInit(Spec(100,20,0,-10,0)) 
    3030trainStats.setCont(Spec(0,0,10,0,5)) 
    31 train = Building('train', TRANSPORT, trainStats) 
     31train = Building('train', TRANSPORT, trainStats, (0,0,0)) 
    3232train.setMenuDescript("This is a train") 
    3333train.setDetailedDescript("This is a very long descrption of a train.  \ 
     
    4141planeStats.setInit(Spec(100,20,0,-10,0)) 
    4242planeStats.setCont(Spec(0,0,10,0,5)) 
    43 plane = Building('plane', TRANSPORT, planeStats) 
     43plane = Building('plane', TRANSPORT, planeStats, (0,0,0)) 
    4444plane.setMenuDescript("This is a plane") 
    4545plane.setDetailedDescript("This is a detailed description of a plane.") 
     
    5252spaceshipStats.setInit(Spec(1000,20,0,-10,0)) 
    5353spaceshipStats.setCont(Spec(0,0,10,0,5)) 
    54 spaceship = Building('spaceship', TRANSPORT, spaceshipStats) 
     54spaceship = Building('spaceship', TRANSPORT, spaceshipStats, (0,0,0)) 
    5555spaceship.setMenuDescript("This is a spaceship") 
    5656spaceship.setDetailedDescript("This is a detailed description of a spaceship.") 
     
    6363windmillStats.setInit(Spec(1000,20,0,-10,0)) 
    6464windmillStats.setCont(Spec(0,0,10,0,5)) 
    65 windmill = Building('windmill', POWER, windmillStats) 
     65windmill = Building('windmill', POWER, windmillStats, (0,0,0)) 
    6666windmill.setMenuDescript("This is a windmill") 
    6767windmill.setDetailedDescript("This is a detailed description of a windmill.") 
     
    7474solarPanelStats.setInit(Spec(1000,20,0,-10,0)) 
    7575solarPanelStats.setCont(Spec(0,0,10,0,5)) 
    76 solarPanel = Building('solarpanel', POWER, solarPanelStats) 
     76solarPanel = Building('solarpanel', POWER, solarPanelStats, (0,0,0)) 
    7777solarPanel.setMenuDescript("This is a solar panel") 
    7878solarPanel.setDetailedDescript("This is a detailed description of a solar panel.") 
     
    8585nuclearPlantStats.setInit(Spec(1000,20,0,-10,0)) 
    8686nuclearPlantStats.setCont(Spec(0,0,10,0,5)) 
    87 nuclearPlant = Building('nuclearplant', POWER, nuclearPlantStats) 
     87nuclearPlant = Building('nuclearplant', POWER, nuclearPlantStats, (0,0,0)) 
    8888nuclearPlant.setMenuDescript("This is a nuclear plant") 
    8989nuclearPlant.setDetailedDescript("This is a detailed description of a nuclear plant.") 
     
    9696mineStats.setInit(Spec(1000,20,0,-10,0)) 
    9797mineStats.setCont(Spec(0,0,10,0,5)) 
    98 mine = Building('mine', MATERIALS, mineStats) 
     98mine = Building('mine', MATERIALS, mineStats, (0,0,0)) 
    9999mine.setMenuDescript("This is a mine") 
    100100mine.setDetailedDescript("This is a detailed description of a mine.") 
  • src/building.py

    r41 r96  
    1010    """ Contains data and stats object for each building """ 
    1111     
    12     def __init__(self, name, type, stats): 
     12    def __init__(self, name, type, stats, threshold): 
    1313        self.name = name 
    1414        self.buildingType = type 
    1515        self.stats = stats 
     16        self.threshold = threshold 
    1617        self.menuDescript = None 
    1718        self.detailedDescript = None 
     19 
    1820 
    1921        # Note that this should not include 
     
    3234    def setImageFileName(self, fileName): 
    3335        self.imageFileName = fileName 
     36     
     37    def getThreshold(self): 
     38        return self.threshold 
    3439         
    3540    def getStats(self): 
  • src/color.py

    r60 r96  
    1818CYAN = (0,255,255) 
    1919MAUVE = (224,176,255) 
    20 GRAY = (72,209,204) 
     20GRAYBLUE = (72,209,204) 
     21GRAY = (172,172,172) 
  • src/state.py

    r84 r96  
    1616        self.specs = newSpec 
    1717        self.currentBuildings = [] 
     18        self.currentResearch = (0,0,0) 
    1819         
    1920    def copy(self): 
     
    2324    def checkThresh(self,building): 
    2425        stats = building.getStats() 
     26        thresholds = building.getThreshold() 
    2527        if stats.initSpecs.getMoney() <= self.specs.getMoney(): 
    2628            if stats.initSpecs.getMaterial() <= self.specs.getMaterial(): 
    27                 return True 
     29                if thresholds[0] <= self.currentResearch[0] and \ 
     30                thresholds[1] <= self.currentResearch[1] and \ 
     31                thresholds[2] <= self.currentResearch[2]: 
     32                    return True 
    2833        return False 
    2934     
     
    3641        if DEBUG: 
    3742            print "Added:", building, " Current buildings: ", self.currentBuildings  
     43     
     44    # Adds money that was researched 
     45    def addResearchMoney(self,type,amount): 
     46        self.currentResearch[type] += amount 
    3847             
    3948         
  • src/staticWindows.py

    r92 r96  
    2525backGround = Window('background',0,0) 
    2626backGroundEntry = WindowEntry(Response('windows',[],False,False)) 
    27 openingArt = pygame.image.load(resourceDir + os.sep + "menu_icons" + os.sep +"intro1.jpg") 
     27openingArt = pygame.image.load(pngDir +"background.png") 
    2828backGroundEntry.addImage(Image((0,0),1080,792,openingArt)) 
    2929backGround.addEntry(backGroundEntry) 
  • src/ui.py

    r92 r96  
    1111from window import * 
    1212from windowEntry import * 
     13import copy 
    1314 
    1415 
     
    7374                for i in reversed(range(len(self.windows))): 
    7475                    # get response from each window, starting with most recent 
    75                     response = self.windows[i].response(self.lastClick) 
     76                    response = copy.deepcopy(self.windows[i].response(self.lastClick)) 
    7677                     
    7778