Beispiel #1
0
 def swapWeapons(self):
     temp = self.primaryWeapon
     self.primaryWeapon = self.secondaryWeapon
     self.secondaryWeapon = temp
     self.image = functions.loadImage('../images/%s' % self.type +
                                      '_%s' % self.primaryWeapon.name +
                                      '.png')
     self.rangeHaloImage = functions.loadImage(
         HALOS[self.primaryWeapon.range * 2])
     self.rangeHaloRect = pygame.rect.Rect(
         self.rect.center,
         (self.primaryWeapon.range * 2, self.primaryWeapon.range * 2))
Beispiel #2
0
    def switchWeapons(self, weapon):

        self.primaryWeapon = weapon
        self.image = functions.loadImage('../images/%s' % self.type +
                                         '_%s' % self.primaryWeapon.name +
                                         '.png')

        self.rangeHaloImage = pygame.image.load(
            HALOS[self.primaryWeapon.range * 2])
        self.rangeHaloRect = self.rangeHaloImage.get_rect(
            center=self.rect.center)
        self.rangeHaloUnderlay = Element(self.rangeHaloImage,
                                         self.rangeHaloRect, True)
Beispiel #3
0
    def __init__(self,
                 image='../images/squad1_handToHand.png',
                 critical=False,
                 spawn=(20, 20)):
        self.speed = 6
        self.aiming = False
        self.moving = False
        self.shoot = False
        self.lastAttack = 0
        self.critical = critical
        self.spawn = spawn
        self.primaryWeapon = guns.HandToHand()
        self.secondaryWeapon = guns.HandToHand()
        self.image = functions.loadImage(image)
        self.rect = self.image.get_rect(center=self.spawn)
        self.hitbox = self.image.get_rect(center=self.spawn,
                                          width=30,
                                          height=30)
        self.type = image[10:16]
        self.name = self.type
        super(Squad, self).__init__()

        self.lifeBarImage = pygame.image.load('../images/lifebar.png')
        self.lifeBarRect = self.lifeBarImage.get_rect(left=self.rect.left)
        self.lifeBar = Element(self.lifeBarImage, self.lifeBarRect, True)

        self.rangeHaloImage = pygame.image.load(
            HALOS[self.primaryWeapon.range * 2])
        self.rangeHaloRect = self.rangeHaloImage.get_rect(
            center=self.rect.center)
        self.rangeHaloUnderlay = Element(self.rangeHaloImage,
                                         self.rangeHaloRect, True)

        self.moving = False
        self.vectorStack = []
        self.vector = None
        self.rawX = float(self.rect.centerx)
        self.rawY = float(self.rect.centery)
Beispiel #4
0
    def __init__(self, image="../images/player_handToHand.png"):

        self.image = functions.loadImage(image)
        self.rect = self.image.get_rect()
        self.hitbox = self.image.get_rect(width=30, height=30)
        self.type = 'player'

        self.speed = 10
        self.diagSpeed = int(round((self.speed) / math.sqrt(2)))
        self.slowed = False

        self.name = self.type
        self.lifeBarImage = pygame.image.load('../images/lifebar.png')
        self.lifeBarRect = self.lifeBarImage.get_rect(left=self.rect.left)
        self.lifeBar = Element(self.lifeBarImage, self.lifeBarRect, True)

        self.critical = True
        self.movingUp = False
        self.movingDown = False
        self.movingLeft = False
        self.movingRight = False
        self.aiming = False
        self.canAttack = False
        self.lastAttack = 0
        self.moving = False

        self.primaryWeapon = guns.HandToHand()
        self.secondaryWeapon = guns.HandToHand()
        super(Player, self).__init__()
        #current setup needs a halo for each range distance but I am working on stretching halo images
        #range is half the halo
        self.rangeHaloImage = pygame.image.load(
            HALOS[self.primaryWeapon.range * 2])
        self.rangeHaloRect = self.rangeHaloImage.get_rect(
            center=self.rect.center)
        self.rangeHaloUnderlay = Element(self.rangeHaloImage,
                                         self.rangeHaloRect, True)
        self.critical = True