Exemple #1
0
 def __init__(self, game: Game, process, owner):
     Gun.__init__(
         self, game, process,
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.POISONGUN_BULLET_ANIMATION),
         createRectangleBodyTemplate(b2_dynamicBody, 10, 10),
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.POISONGUN_ANIMATION), {
                 "bulletSpeed":
                 40,
                 "bulletType":
                 "BallisticExplode",
                 "bulletPower":
                 20,
                 "ExplodeTime":
                 5.0,
                 "ExplodeDamage":
                 0.2,
                 "ExplodeSize":
                 110,
                 "ExplodeAnimation":
                 game.getTextureManager().getAnimationPack(
                     AnimationPackInfo.POISONEXPLODE_ANIMATION)
             }, owner, "Player", POISON_AMMO)
     self.cooldown = 0.7
Exemple #2
0
 def __init__(self, game: Game, process, owner):
     Gun.__init__(
         self, game, process,
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.GRAVITYGUN_BULLET_ANIMATION),
         createRectangleBodyTemplate(b2_dynamicBody, 1, 1, gravityScale=0),
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.GRAVITYGUN_ANIMATION), {
                 "bulletSpeed":
                 80,
                 "bulletType":
                 "Gravity",
                 "bulletPower":
                 0,
                 "ExplodeTime":
                 0.2,
                 "ExplodeDamage":
                 0,
                 "ExplodeSize":
                 150,
                 "ExplodeAnimation":
                 game.getTextureManager().getAnimationPack(
                     AnimationPackInfo.GRAVITY_EXPLODE_BULLET_ANIMATION)
             }, owner, "Player", GRAVI_AMMO)
     self.cooldown = 0.5
Exemple #3
0
 def __init__(self, game: Game, process, owner):
     Gun.__init__(
         self, game, process,
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.POWERGUN_BULLET_ANIMATION),
         createRectangleBodyTemplate(b2_dynamicBody, 30, 30,
                                     gravityScale=0),
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.POWERGUN_ANIMATION), {
                 "bulletSpeed":
                 80,
                 "bulletType":
                 "TwoDirectionExplode",
                 "bulletPower":
                 30,
                 "ExplodeTime":
                 0.4,
                 "ExplodeDamage":
                 2,
                 "ExplodeSize":
                 65,
                 "ExplodeAnimation":
                 game.getTextureManager().getAnimationPack(
                     AnimationPackInfo.POWER_EXPLODE_BULLET_ANIMATION)
             }, owner, "Player", POWER_AMMO)
     self.cooldown = 1
Exemple #4
0
    def __init__(self, game: Game, process, x, y, player: Player):
        self.__animation = game.getTextureManager().getAnimation(AnimationInfo.BASE_ANIMATION)
        self.__animation.scale2x()
        self.__animation.play()
        self.__light = pg.transform.scale2x(game.getTextureManager().getTexture(TextureInfo.LIGHT_BASE))
        self.__badBase = pg.transform.scale2x(game.getTextureManager().getTexture(TextureInfo.BAD_BASE))
        self.__turnedOn = False
        self.__player = player
        self.__rect = rectFromSize(x, y, *self.__light.get_size())

        self.__path = []
        self.__originalPath = []
        self.__movingTo = b2Vec2(0, 0)
        self.__pos = b2Vec2(x, y)
        self.__speed = BASE_SPEED

        self.__healCooldown = HEAL_COOLDOWN
        self.__sinceLastHeal = self.__healCooldown
        self.__ammoCooldown = AMMO_COOLDOWN
        self.__sinceLastAmmo = self.__ammoCooldown

        self.__sinceLastDisappear = 0
        self.__disappearMoment = BASE_DISAPPEAR_TIME
        self.__appearMoment = self.__disappearMoment + BASE_APPEAR_TIME

        self.__lowerPlatform = BasePlatform(game, process, x, y)
        self.__upperPlatform = BasePlatform(game, process, x,
                                            y + self.__light.get_size()[1] - self.__lowerPlatform.getAABB().h)
Exemple #5
0
 def __init__(self, game: Game, process, owner):
     Gun.__init__(
         self, game, process,
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.BALLISTICGUN_BULLET_ANIMATION),
         createRectangleBodyTemplate(b2_dynamicBody, 10, 10),
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.BALLISTICGUN_ANIMATION), {
                 "bulletSpeed": 40,
                 "bulletType": "Ballistic",
                 "bulletPower": 20
             }, owner, "Enemy", 1000_000)
     self.cooldown = 0.7
Exemple #6
0
 def __init__(self, game: Game, process, owner):
     Gun.__init__(
         self, game, process,
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.BIG_ENEMY_BULLET_ANIMATION),
         createRectangleBodyTemplate(b2_dynamicBody, 40, 40,
                                     gravityScale=0),
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.BIG_ENEMY_GUN_ANIMATION), {
                 "bulletSpeed": 80,
                 "bulletType": "AllDirection",
                 "bulletPower": 5
             }, owner, "BigEnemy", 1000_000)
     self.cooldown = 0
Exemple #7
0
    def __init__(self, game: Game, pos: tuple):
        self.__background = pg.transform.scale2x(game.getTextureManager().getTexture(TextureInfo.GUNS_BACKGROUND))
        self.__pos = pos
        self.__guns = [game.getTextureManager().getTexture(info)
                       for info in (TextureInfo.GUN1,
                                    TextureInfo.GUN2,
                                    TextureInfo.GUN3)]
        self.__detGuns = [game.getTextureManager().getTexture(info)
                          for info in (TextureInfo.DETALIZED_GUN1,
                                       TextureInfo.DETALIZED_GUN2,
                                       TextureInfo.DETALIZED_GUN3)]
        self.__numbers = list(map(pg.transform.scale2x, game.getTextureManager().getNumbers()))
        self.__i = 0

        self.__guns = list(map(pg.transform.scale2x, self.__guns))
        self.__detGuns = list(map(pg.transform.scale2x, self.__detGuns))
    def __init__(self, game: Game):
        self.__world = b2World((0, -100))
        self.__contactListener = ContactListener()
        self.__world.contactListener = self.__contactListener
        self.__factory = BodyFactory(self.__world)
        self.__background = pg.transform.scale(
            game.getTextureManager().getTexture(TextureInfo.BACKGROUND),
            WINDOW_RESOLUTION)

        self.__game = game
        self.__events = []
        self.__justCreatedObjects = set()
        self.__removedObjects = set()
        self.__objects = set()
        self.__cameraRect = rectFromSize(0, -WINDOW_RESOLUTION[1],
                                         *WINDOW_RESOLUTION)

        self.__player = Player(game, self, GunsList(game, (20, 20)))
        self.addObject(self.__player)
        self.__base = Base(game, self, *BASE_START_POS, self.__player)

        self.__builder = Builder(game)
        self.__builder.build(self, self.__player, self.__base, "L1")

        pg.mixer.music.load(_createPath('music', 'fight.mp3'))
        pg.mixer.music.play()
Exemple #9
0
 def __init__(self, game: Game, process, x: float, y: float, width: float,
              height: float):
     # process: GameProcess
     Platform.__init__(
         self, game, process,
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.PLATFORM_ANIMATION), x, y, width, height)
 def __init__(self, game: Game, process, guiGuns: GunsList):
     # process: GameProcess
     ActiveObject.__init__(self, game, process,
                           game.getTextureManager().getAnimationPack(AnimationPackInfo.PLAYER_ANIMATION),
                           process.getFactory().createRectangleBody(b2_dynamicBody, 40, 100),
                           20, 40, [PoisonGun(game, process, self), PowerGun(game, process, self), GravityGun(game, process, self)])
     self.__actions = set()
     self.resetHp(PLAYER_HP)
     self.__guiGuns = guiGuns
Exemple #11
0
 def __init__(self, game: Game, process, player: Player, x: float,
              y: float):
     Enemy.__init__(
         self, game, process, player,
         game.getTextureManager().getAnimationPack(
             AnimationPackInfo.ANT_ANIMATION),
         process.getFactory().createRectangleBody(b2_dynamicBody, 22, 18),
         10, 0, [])
     self.setPosition(x, y)
     self.resetHp(ANT_HP)
 def __init__(self,
              game: Game,
              process,
              x: float,
              y: float,
              width: float,
              height: float,
              animationPack=None):
     # process: GameProcess
     if animationPack is None:
         animationPack = game.getTextureManager().getAnimationPack(
             AnimationPackInfo.HALF_COL_PLATFORM_ANIMATION)
     Platform.__init__(self, game, process, animationPack, x, y, width,
                       height)
     self._notColliding = set()
 def __init__(self, game: Game, process, player: Player, x: float, y: float):
     Spawner.__init__(self, game, process, player, 100,
                      game.getTextureManager().getAnimationPack(AnimationPackInfo.ANTHILL_ANIMATION),
                      process.getFactory().createRectangleBody(b2_staticBody, 51, 39),
                      Ant, x=x + 20, y=y + 25)
     self.setPosition(x, y)
Exemple #14
0
 def __init__(self, game: Game):
     self.__upper = game.getTextureManager().getTexture(TextureInfo.HEALTH_BAR_UPPER)
     self.__lower = game.getTextureManager().getTexture(TextureInfo.HEALTH_BAR_LOWER)
     self.__bar = game.getTextureManager().getTexture(TextureInfo.HEALTH_BAR)
     self.__rect = rectFromSize(0, 0, *self.__lower.get_size())
Exemple #15
0
 def __init__(self, game: Game, process, player: Player, x: float, y: float):
     super().__init__(game, process, player,
                      game.getTextureManager().getAnimationPack(AnimationPackInfo.STUPID_ENEMY_ANIMATION),
                      process.getFactory().createRectangleBody(b2_dynamicBody, 40, 100),
                      UsualGun(game, process, self), x, y)