diff options
Diffstat (limited to 'brutalmaze/characters.py')
-rw-r--r-- | brutalmaze/characters.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/brutalmaze/characters.py b/brutalmaze/characters.py index 7e9312e..7fa8c93 100644 --- a/brutalmaze/characters.py +++ b/brutalmaze/characters.py @@ -19,15 +19,15 @@ __doc__ = 'Brutal Maze module for hero and enemy classes' from collections import deque -from math import atan2, gcd, sin, pi +from math import atan2, gcd, pi, sin from random import choice, randrange, shuffle from sys import modules -from .constants import ( - TANGO, HERO_HP, SFX_HEART, HEAL_SPEED, MIN_BEAT, ATTACK_SPEED, ENEMY, - ENEMY_SPEED, ENEMY_HP, SFX_SPAWN, SFX_SLASH_HERO, MIDDLE, WALL, FIRANGE, - AROUND_HERO, ADJACENTS, EMPTY, SQRT2, ENEMIES) -from .misc import sign, randsign, regpoly, fill_aapolygon, play +from .constants import (ADJACENTS, AROUND_HERO, ATTACK_SPEED, EMPTY, + ENEMIES, ENEMY, ENEMY_HP, ENEMY_SPEED, FIRANGE, + HEAL_SPEED, HERO_HP, MIDDLE, MIN_BEAT, SFX_HEART, + SFX_SLASH_HERO, SFX_SPAWN, SQRT2, TANGO, WALL) +from .misc import fill_aapolygon, play, randsign, regpoly, sign from .weapons import Bullet @@ -273,7 +273,7 @@ class Enemy: if self.spin_queue and wound: self.maze.hit_hero(wound, self.color) return wound - def get_angle(self, reversed=False): + def get_angle(self): """Return the angle of the vector whose initial point is the center of the screen and terminal point is the center of the enemy. @@ -347,12 +347,12 @@ class Chameleon(Enemy): visible (float): time until the Chameleon is visible (in ms) """ def __init__(self, maze, x, y): - Enemy.__init__(self, maze, x, y, 'Chameleon') + super().__init__(maze, x, y, 'Chameleon') self.visible = 0.0 def wake(self): """Wake the Chameleon up if it can see the hero.""" - if Enemy.wake(self) is True: + if super().wake() is True: self.visible = 1000 / ENEMY_SPEED def isunnoticeable(self, x=None, y=None): @@ -361,25 +361,25 @@ class Chameleon(Enemy): Only search within column x and row y if these coordinates are provided. """ - return (Enemy.isunnoticeable(self, x, y) + return (super().isunnoticeable(x, y) or self.visible <= 0 and not self.spin_queue and self.maze.next_move <= 0) def update(self): """Update the Chameleon.""" - Enemy.update(self) + super().update() if self.awake: self.visible -= 1000 / self.maze.fps def hit(self, wound): """Handle the Chameleon when it's attacked.""" self.visible = 1000.0 / ENEMY_SPEED - Enemy.hit(self, wound) + super().hit(wound) class Plum(Enemy): """Object representing an enemy of Plum.""" def __init__(self, maze, x, y): - Enemy.__init__(self, maze, x, y, 'Plum') + super().__init__(maze, x, y, 'Plum') def clone(self, other): """Turn the other enemy into a clone of this Plum and return @@ -396,18 +396,18 @@ class Plum(Enemy): class ScarletRed(Enemy): """Object representing an enemy of Scarlet Red.""" def __init__(self, maze, x, y): - Enemy.__init__(self, maze, x, y, 'ScarletRed') + super().__init__(maze, x, y, 'ScarletRed') def fire(self): """Scarlet Red doesn't shoot.""" return False def move(self): - return Enemy.move(self, ENEMY_SPEED * SQRT2) + return super().move(self, ENEMY_SPEED * SQRT2) def slash(self): """Handle the Scarlet Red's close-range attack.""" - self.wound -= Enemy.slash(self) + self.wound -= super().slash() if self.wound < 0: self.wound = 0.0 |