Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def isBombed(self, data):
pygame.time.wait(50)
self.state = 'bombed'
SmokeSpawner(data, (self.rect.midbottom), randint(5, 9), 3) # smoke for the wreckage
if randint(0, 3) == 0: # sometimes add another smoke spawner randomly
SmokeSpawner(data, (self.rect.x + randint(5, self.rect.width - 6), self.rect.bottom), randint(3, 5), 2)
self.remove(data.standingBuildings)
def __init__(self, data, topleft, velocity=(0, fallSpeed)):
pygame.sprite.Sprite.__init__(self)
self.add(data.bombs)
self.baseImage = Bomb.baseImage
self.baseImageSize = self.baseImage.get_size()
bomb_size = int(get_val(os.environ, 'BOMB', 1.))
self.baseImage = pygame.transform.scale(self.baseImage,
(self.baseImageSize[0] * bomb_size,
self.baseImageSize[1] * bomb_size))
self.rotation = 0.0
self.rect = self.baseImage.get_rect(topleft=topleft)
self.yCoord = topleft[1] # float for accuracy
self.fallSpeed = Bomb.fallSpeed
self.smoke = SmokeSpawner(data, self.rect.midtop, 2)
def isBombed(self, data):
self.state = 'bombed'
SmokeSpawner(data, (self.rect.midbottom), randint(5, 9), 3) # smoke for the wreckage
if randint(0, 3) == 0: # sometimes add another smoke spawner randomly
SmokeSpawner(data, (self.rect.x + randint(5, self.rect.width - 6), self.rect.bottom), randint(3, 5), 2)
data.shakeScreen(30)
pygame.sprite.Sprite.__init__(self)
self.add(data.bombers)
self.add(data.bulletproofEntities)
self.add(data.superbombableEntities)
self.imageL = data.loadImage('assets/enemies/bomber.png')
self.imageR = pygame.transform.flip(self.imageL, 1, 0)
self.droppedBomb = False
self.timeTillBombPrimed = random.uniform(Bomber.minTimeToDropBomb, Bomber.maxTimeToDropBomb)
self.lastBombDropTime = time.time()
self.rect = self.imageR.get_rect()
self.targetingRect = pygame.Rect((0, 0), (6, 10)) # BOMB SIZE
self.smoke = SmokeSpawner(data, self.rect.topleft, 10)
if startAtLeft:
self.direction = 'right'
self.image = self.imageR
self.rect.topright = (0, yPos)
else:
self.direction = 'left'
self.image = self.imageL
self.rect.topleft = (data.WINDOWWIDTH, yPos)
self.coords = list(self.rect.topleft) # for more accurate positioning using floats
sound.play('swoosh', 0.3)