예제 #1
0
 def actionPlaceUnit(self):
     ix, iy = self.sprite.get_size()
     if inputcontrol.getMouseOverObject(self.x, self.y, ix, iy) == True:
         self.sprite = self.spriteClicked
         if globalvars.reinforcements > 0:
             globalvars.placenewunit = True
             globalvars.reinforcements -= 1
예제 #2
0
 def actionEndTurn(self):
     ix, iy = self.sprite.get_size()
     if inputcontrol.getMouseOverObject(self.x, self.y, ix, iy) == True:
         self.sprite = self.spriteClicked
         if globalvars.turn == 0:
             globalvars.turn = 1
             globalvars.currentTurn += 1
예제 #3
0
 def actionEndTurn(self):
     ix, iy = self.sprite.get_size()
     if (inputcontrol.getMouseOverObject(self.x, self.y, ix, iy) == True):
         self.sprite = self.spriteClicked
         if (globalvars.turn == 0):
             globalvars.turn = 1
             globalvars.currentTurn += 1
예제 #4
0
 def actionPlaceUnit(self):
     ix, iy = self.sprite.get_size()
     if (inputcontrol.getMouseOverObject(self.x, self.y, ix, iy) == True):
         self.sprite = self.spriteClicked
         if (globalvars.reinforcements > 0):
             globalvars.placenewunit = True
             globalvars.reinforcements -= 1
예제 #5
0
 def actionAirforce(self):
     ix, iy = self.sprite.get_size()
     if inputcontrol.getMouseOverObject(self.x, self.y, ix, iy) == True:
         self.sprite = self.spriteClicked
예제 #6
0
 def actionAirforce(self):
     ix, iy = self.sprite.get_size()
     if (inputcontrol.getMouseOverObject(self.x, self.y, ix, iy) == True):
         self.sprite = self.spriteClicked
예제 #7
0
                                         battles[inputcontrol.getMouseOverSquare(width, height, objectsPerWidth)].battleUnitPlayer.append(unit[ii])
                                     else:
                                         a = 0
                                         for o in battles[inputcontrol.getMouseOverSquare(width, height, objectsPerWidth)].battleUnitPlayer:
                                             if unit[ii] is o:
                                                 a = 1
                                         if a == 0:
                                             battles[inputcontrol.getMouseOverSquare(width, height, objectsPerWidth)].battleUnitPlayer.append(unit[ii])
                                             
                                     
 
                             
     elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
         #Place new units/other objects if needed
         if globalvars.placenewunit == True:
             if inputcontrol.getMouseOverObject(0, 0, width, height):
                 unit.append(assets.classTypeUnit(inputcontrol.getMouseOverSquare(width, height, objectsPerWidth),squareSprites.unit,squareSprites.unitSelected,True))
                 globalvars.placenewunit = False
         #Select units
         for ii, iii in enumerate(unit):
             unit[ii].selected = False
             if unit[ii].idx == inputcontrol.getMouseOverSquare(width, height,objectsPerWidth):
                 c = 0
                 for a,b in enumerate(unit):
                     if unit[a].selected == True:
                         c += 1
                         if c > 1:
                             break
                         else: unit[a].selected = True
                 if c == 0:
                     unit[ii].selected = True
예제 #8
0
                                                    )].battleUnitPlayer:
                                                if unit[ii] is o:
                                                    a = 1
                                            if a == 0:
                                                battles[
                                                    inputcontrol.
                                                    getMouseOverSquare(
                                                        width, height,
                                                        objectsPerWidth
                                                    )].battleUnitPlayer.append(
                                                        unit[ii])

        elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
            #Place new units/other objects if needed
            if globalvars.placenewunit == True:
                if inputcontrol.getMouseOverObject(0, 0, width, height):
                    unit.append(
                        assets.classTypeUnit(
                            inputcontrol.getMouseOverSquare(
                                width, height,
                                objectsPerWidth), squareSprites.unit,
                            squareSprites.unitSelected, True))
                    globalvars.placenewunit = False
            #Select units
            for ii, iii in enumerate(unit):
                unit[ii].selected = False
                if unit[ii].idx == inputcontrol.getMouseOverSquare(
                        width, height, objectsPerWidth):
                    c = 0
                    for a, b in enumerate(unit):
                        if unit[a].selected == True: