Exemplo n.º 1
0
 def __init__(self, mapName, rows, cols, scale):
     self.image = load.load_image_smooth(fileName = 'maps/%s.jpg' %mapName, scale = scale)
     self.original= load.load_image_smooth(fileName = 'maps/%s.jpg' %mapName, scale = scale)
     self.mini_map = load.load_image_smooth(fileName = 'maps/%s.jpg' %mapName, scale = 1.0/16)
     self.board = load.load_map_data(fileName = mapName + '.txt')
     self.rows = rows
     self.cols = cols
     self.fogOfWarBoard = [[[0] * cols for row in xrange(rows)],[[0] * cols for row in xrange(rows)]]
     self.x = 0
     self.y = 0
     self.rect = pygame.Surface.get_rect(self.image)
     self.width,self.height = pygame.Surface.get_size(self.image)
     self.scale = scale
     self.display = pygame.display.get_surface()
     self.displayWidth, self.displayHeight = pygame.Surface.get_size(self.display)
Exemplo n.º 2
0
 def __init__(self,row,col):
     imageName = 'Terran/Engineering Bay.gif'
     super(EngineeringBay,self).__init__(row,col,3,3,850,0,imageName)
     self.xerror = -5
     self.yerror = 20
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.1)
     self.buildRound = 3
Exemplo n.º 3
0
 def __init__(self,row,col):
     imageName = 'Terran/Science Facility.gif'
     super(ScienceFacility,self).__init__(row,col,3,3,750,0,imageName)
     self.xerror = 0
     self.yerror = 20
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.3)
     self.buildRound = 3
Exemplo n.º 4
0
 def __init__(self,row,col):
     imageName = 'Terran/Missile Turret.gif'
     super(MissileTurret,self).__init__(row,col,2,2,200,0,imageName)
     self.xerror = 10
     self.yerror = 0
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.5)
     self.buildRound = 2
Exemplo n.º 5
0
 def __init__(self,row,col):
     imageName = 'Terran/Refinery.gif'
     super(Gas,self).__init__(row,col,2,4,750,0,imageName)
     self.xerror = 20
     self.yerror = -10
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.2)
     self.buildRound = 1
Exemplo n.º 6
0
    def __init__(self, row, col, sizeRow, sizeCol, health, sheild, healthRegen, sheildRegen, imageName):
        self.row = row
        self.col = col
        self.sizeRow = sizeRow
        self.sizeCol = sizeCol
        self.image = load.load_image_smooth('Buildings/' + imageName, 1.5)
        self.Map = building.Map

        self.health = health
        self.CURhealth = health
        self.sheild = sheild
        self.CURsheild = sheild
        # set the x, y error for the image
        self.xerror = 10
        self.yerror = 0

        self.supply = False

        self.Build = [ ]
        self.BuildSize = []
        self.BuildRound = []
        self.buildQueue = []
        self.currentBuildRoundLeft = []

        building.buildings.append(self)
        building.buildingBuildings.append(self)
Exemplo n.º 7
0
 def __init__(self,row,col):
     imageName = 'Terran/Armory.gif'
     super(Armory,self).__init__(row,col,3,3,750,0,imageName)
     self.xerror = 0
     self.yerror = 0
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.4)
     self.buildRound = 3
Exemplo n.º 8
0
 def __init__(self,row,col):
     imageName = 'Terran/Supply Depot.gif'
     super(SupplyDepot,self).__init__(row,col,2,2,500,0,imageName)
     self.xerror = -5
     self.yerror = 0
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.1)
     self.buildRound = 1
     self.supply = 12
Exemplo n.º 9
0
 def __init__(self, row, col):
     imageName = 'Protoss/Stargate.gif'
     super(Stargate, self).__init__(row, col, 3, 3, 500, 500, imageName)
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.2)
     self.xerror = 0
     self.yerror = 0
     self.Build = [ProtossUnit.Arbiter]
     self.BuildSize = [(2,2)]
     self.BuildRound = [4]
Exemplo n.º 10
0
 def __init__(self,row,col):
     imageName = 'Terran/Factory.gif'
     super(Factory,self).__init__(row,col,3,3,1000,0,imageName)
     self.xerror = 0
     self.yerror = 0
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.3)
     self.buildRound = 3
     self.Build = [TerranUnit.SiegeTank]
     self.BuildSize = [(2,2)]
     self.BuildRound = [4]
Exemplo n.º 11
0
 def __init__(self,row,col):
     imageName = 'Terran/Barracks.gif'
     super(Barrack,self).__init__(row,col,3,3,1000,0,imageName)
     self.xerror = 0
     self.yerror = 0
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.2)
     self.buildRound = 2
     self.Build = [TerranUnit.Marine,TerranUnit.Medic,TerranUnit.FireBat]
     self.BuildSize = [(1,1),(1,1),(1,1)]
     self.BuildRound = [2,2,3]
Exemplo n.º 12
0
 def __init__(self, row, col):
     imageName = 'Protoss/Gateway.gif'
     super(Gateway, self).__init__(row, col, 3, 3, 500, 500, imageName)
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.2)
     self.xerror = 0
     self.yerror = 10
     self.buildRound = 2
     self.Build = [ProtossUnit.Zealot]
     self.BuildSize = [(1,1)]
     self.BuildRound = [2]
Exemplo n.º 13
0
 def __init__(self,row,col):
     imageName = 'Terran/Starport.gif'
     super(Starport,self).__init__(row,col,3,3,1000,0,imageName)
     self.xerror = 0
     self.yerror = 0
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.3)
     self.buildRound = 3
     self.Build = [TerranUnit.BattleCrusier]
     self.BuildSize = [(2,2)]
     self.BuildRound = [5]
Exemplo n.º 14
0
 def __init__(self,row,col):
     imageName = 'Terran/Command Center.gif'
     super(CommandCenter,self).__init__(row,col,3,4,1500,0,imageName)
     self.xerror = 10
     self.yerror = 0
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.3)
     self.buildRound = 5
     self.supply = 12
     self.Build = [TerranUnit.SCV]
     self.BuildSize = [(1,1)]
     self.BuildRound = [2]
Exemplo n.º 15
0
    def __init__(self,row,col):
        imageName = 'Battlecruiser.gif'
        super(BattleCrusier,self).__init__(row,col,2,2,500,0,0,0,60,5,8,imageName)
        self.image = load.load_image_smooth('Units/Terran/Battlecruiser.gif',scale = 1.2)
        sounds = load.load_sounds_in_Folder('Terran/Battle/')
        self.deathSound = [sounds[0]]
        self.hitSound = [sounds[-1]]
        self.idleSounds = sounds[2:len(sounds)-1]
        self.population = 6

        self.xerror = 0
Exemplo n.º 16
0
 def __init__(self, row, col):
     imageName = 'Protoss/Nexus.gif'
     super(Nexus, self).__init__(row, col, 3, 4, 750, 750, imageName)
     self.xerror = 0
     self.yerror = -40
     self.image = load.load_image_smooth('Buildings/'+imageName, scale= 1.3)
     self.buildRound = 5
     self.supply = 10
     self.Build = [ProtossUnit.Probe]
     self.BuildSize = [(1,1)]
     self.BuildRound = [2]
Exemplo n.º 17
0
def drawBuildBuilding(screen,data):
    if data.buildMode == True:
        x,y = data.mouseX, data.mouseY
        index = data.currentBuildIndex
        if index != None:
            if pygame.key.get_pressed()[K_b] == 1:
                cls = data.selected.Build[index]
                data.currentBuildClass = cls
                image = load.load_image_smooth(cls.image, cls.scale)
            elif pygame.key.get_pressed()[K_v] == 1:
                cls = data.selected.AdvancedBuild[index]
                data.currentBuildClass = cls
                image = load.load_image_smooth(cls.image,cls.scale)
            cW,cH = data.map.getCellsize()
            mRow = data.mouseY/cH
            mCol = data.mouseX/cW
            sRow = data.map.y/cH
            sCol = data.map.x/cW
            sizeRow, sizeCol = cls.sizeRow, cls.sizeCol
            y = (mRow) * cH + cls.yerror
            x = (mCol) * cW + cls.xerror

            screen.blit(image,(x,y))

            redBlock = pygame.Surface((cW,cH),pygame.SRCALPHA)
            greenBlock = pygame.Surface((cW,cH),pygame.SRCALPHA)
            redBlock.fill((200,0,0,120))
            greenBlock.fill((0,200,0,120))
            for r in xrange(sizeRow):
                for c in xrange(sizeCol):
                    if (mRow+r-data.selected.row)**2 + (mCol+c-data.selected.col)**2 > 49 or \
                            (data.selected.Map.board[mRow-sRow+r][mCol-sCol+c] != 0 and\
                                    data.selected.Map.board[mRow-sRow+r][mCol-sCol+c] != 2):
                        screen.blit(redBlock,((mCol+c)*cW,(mRow+r)*cH))
                    else:
                        screen.blit(greenBlock,((mCol+c)*cW,(mRow+r)*cH))
Exemplo n.º 18
0
    def __init__(self,row,col,sizeRow, sizeCol,health,sheild,sheildRegen,healthRegen, attack, AttRange, MovRange, imageName):

        self.row = row
        self.col = col
        self.sizeRow = sizeRow
        self.sizeCol = sizeCol

        self.health = health
        self.sheild = sheild
        self.CURhealth = health
        self.CURsheild = sheild
        self.sheildRegen = sheildRegen
        self.healthRegen = healthRegen

        self.population = 0

        self.attack = attack
        self.AttRange = AttRange
        self.MovRange = MovRange
        self.canMove = True
        self.canAttack = True
        self.canBuild = False

        self.AirUnit = False
        self.stealth = False
        self.dectection = False

        self.image = load.load_image_smooth('Units/' + imageName, 1.5)
        self.xerror = 0
        self.yerror = 0
        self.Map = Unit.Map

        self.tile_cache = [0] * self.sizeRow * self.sizeCol


        Unit.Units.append(self)