def update(self): if not self.cooldown: if self.active: self.ammo -= 1 self.cooldown = K_COOLDOWN x = elements.bullet( ((random.randint(1, 255)), (random.randint(1, 255)), (random.randint(1, 255))), (self.father.rect.topright), self.direction, father=self.father, ) bullets.add(x) x = elements.bullet( ((random.randint(1, 255)), (random.randint(1, 255)), (random.randint(1, 255))), ((self.father.rect.right, self.father.rect.centery)), self.direction, father=self.father, ) bullets.add(x) x = elements.bullet( ((random.randint(1, 255)), (random.randint(1, 255)), (random.randint(1, 255))), (self.father.rect.bottomright), self.direction, father=self.father, ) bullets.add(x) snd_master.play("shoot") if not self.ammo: game_master.game_m.set_base_weapon(self.father) self.kill() else: self.cooldown -= 1
def update(self): if not self.cooldown: if self.active: self.cooldown = K_COOLDOWN x = elements.bullet( ((random.randint(1, 255)), (random.randint(1, 255)), (random.randint(1, 255))), (self.father.rect.center), self.direction, father=self.father, ) snd_master.play("shoot") bullets.add(x) else: self.cooldown -= 1
def update(self, event=None, rest=None): self.degree += 5 self.degree = self.degree % 360 self.rect = self.rect.move(-K_ENEMY_MOV, self.amp * math.sin(math.radians(self.degree))) if self.rect.bottom >= K_WINDOW_DIM[1]-8 or self.rect.top <= 0: self.degree = (self.degree + 180) % 360 if self.rect.right < -10: self.silent_die() if not self.cooldown: if random.randint(1,10) <= 6: x = elements.bullet( (0,0,0), (self.rect.left, self.rect.centery), (-1,0), 0.5) en_bullets.add(x) self.cooldown = int(K_COOLDOWN/math.log(game_m.get_level()+1)) + random.randint(1, 10) else: self.cooldown -= 1
def update(self, event=None, rest=None): if random.randint(0,1): if random.randint(0,1): if not self.rect.bottom >= K_WINDOW_DIM[1]: self.rect = self.rect.move(0, K_ENEMY_MOV) else: if not self.rect.top <= 0: self.rect = self.rect.move(0, -K_ENEMY_MOV) else: if random.randint(0,1): if not self.rect.right >= K_WINDOW_DIM[0]: self.rect = self.rect.move(K_ENEMY_MOV, 0) else: if not self.rect.left <= 0: self.rect = self.rect.move(-K_ENEMY_MOV, 0) if not self.cooldown: self.cooldown = K_COOLDOWN * 20 + random.randint(30, 200) x = elements.bullet( (255,255,255), (self.rect.left, self.rect.centery), (-1,0), 0.5) en_bullets.add(x) else: self.cooldown -= 1