def fire(self): if self.fire_acctime > self.fire_updatetime: # get dir_to_player player = self.good_guys[0] x = int(self.rect.x) y = int(self.rect.y) if player.rect.x in range(x-200, x+200) and\ player.rect.y in range(y-200, y+200): self.fire_acctime = 0 self.fire_updatetime = random.randrange(2000,4000) xvec = player.rect.centerx - self.rect.centerx yvec = player.rect.centery - self.rect.centery dir_to_player = math.atan2(yvec,xvec) * (180/math.pi) # launch projectile new_bullet = projectile.AnimatedBullet(self.proj_images,self.rect.centerx, self.rect.centery,12,12,dir_to_player-4,friction=1.01,speed=1.1,trail=True) self.bullets_list.append(new_bullet) new_bullet = projectile.AnimatedBullet(self.proj_images,self.rect.centerx, self.rect.centery,12,12,dir_to_player,friction=1.01,speed=1.1,trail=True) self.bullets_list.append(new_bullet) new_bullet = projectile.AnimatedBullet(self.proj_images,self.rect.centerx, self.rect.centery,12,12,dir_to_player+4,friction=1.01,speed=1.1,trail=True) self.bullets_list.append(new_bullet)
def fire(self): if self.fire_acctime > self.fire_updatetime: # get dir_to_player player = self.good_guys[0] x = int(self.rect.x) y = int(self.rect.y) if player.rect.x in range(x-100, x+100) and\ player.rect.y in range(y-100, y+100): self.fire_acctime = 0 self.fire_updatetime = random.randrange(2000,6000) dirs = [0,180,90,270] facing = random.choice(dirs) # launch projectile for i in range(8): dir = random.randrange(facing-15,facing+15) new_bullet = projectile.AnimatedBullet("images\\fly_proj.png",self.rect.centerx, self.rect.centery,8,8,dir,friction=1.01,speed=1.98,rotate=True) self.bullets_list.append(new_bullet)
def fire(self): if self.fire_acctime > self.fire_updatetime: # get dir_to_player player = self.good_guys[0] x = int(self.rect.x) y = int(self.rect.y) if player.rect.x in range(x-250, x+250) and\ player.rect.y in range(y-250, y+250): self.fire_acctime = 0 self.fire_updatetime = random.randrange(800,1800) xvec = player.rect.centerx - self.rect.centerx yvec = player.rect.centery - self.rect.centery #dir = random.choice(self.dirs) dir = math.atan2(yvec,xvec) * (180/math.pi) fl = random.random() rand_int = random.randint(1,2) speed = rand_int+fl # launch projectile new_bullet = projectile.AnimatedBullet("images\\fr_proj.png",self.rect.centerx, self.rect.centery,12,12,dir,trail=True,speed=speed,fps=15) self.bullets_list.append(new_bullet)
def fire(self): if self.fireacctime > self.fire_rate: self.fireacctime = 0 # launch bullet new_bullet = projectile.AnimatedBullet(self.path,self.player.magic_orb.rect.centerx, self.player.magic_orb.rect.centery, 6,6, self.player.firing_angle,speed = self.bullet_speed, friction = self.friction, fps=18, rotate=False,trail=True) self.player.bullets_list.append(new_bullet) self.player.sound_manager.play("basic.ogg")
def fire(self): if self.player.mana_amount >= self.mana_req: if self.fireacctime > self.fire_rate: self.fireacctime = 0 dirs = [self.player.firing_angle-5,self.player.firing_angle+5] for i in range(2): # launch bullet new_bullet = projectile.AnimatedBullet(self.path,self.player.magic_orb.rect.centerx,self.player.magic_orb.rect.centery, 8,8, dirs[i],speed = self.bullet_speed, friction = self.friction, fps=12, rotate=True,trail=True) self.player.bullets_list.append(new_bullet) self.player.mana_amount -= self.mana_req self.player.sound_manager.play("softgun.ogg")
def fire(self): if self.fire_acctime > self.fire_updatetime: # get dir_to_player player = self.good_guys[0] x = int(self.rect.x) y = int(self.rect.y) if player.rect.x in range(x-100, x+100) and\ player.rect.y in range(y-100, y+100): self.fire_acctime = 0 self.fire_updatetime = random.randrange(2000,6000) dirs = [0,45,90,135,180,225,270,315] # launch projectile for dir in dirs: new_bullet = projectile.AnimatedBullet("images\\sprout_proj.png",self.rect.centerx, self.rect.centery,12,12,dir,speed=2.0,rotate=True,trail=True) self.bullets_list.append(new_bullet)