about summary refs log tree commit diff homepage
path: root/brutalmaze/characters.py
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2017-11-21 21:49:35 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2017-11-21 21:49:35 +0700
commit1578586f24c74786976f0c675c901f5e30fa6bbb (patch)
tree5c5b19c2ce1a07af52acaa465bd1618d10d1f92f /brutalmaze/characters.py
parentfffdd969ad5ab5e4cdde65e0a49940722b1f1282 (diff)
downloadbrutalmaze-1578586f24c74786976f0c675c901f5e30fa6bbb.tar.gz
Update documentation 0.2.0
Diffstat (limited to 'brutalmaze/characters.py')
-rw-r--r--brutalmaze/characters.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/brutalmaze/characters.py b/brutalmaze/characters.py
index 6daaf70..e123dec 100644
--- a/brutalmaze/characters.py
+++ b/brutalmaze/characters.py
@@ -186,14 +186,12 @@ class Enemy:
         if self.offsety:
             self.offsety -= sign(self.offsety)
             return True
-        if (self.next_strike > pygame.time.get_ticks()
-            or (self.x, self.y) in AROUND_HERO):
-            return False
+        if self.next_strike > pygame.time.get_ticks(): return False
 
         self.move_speed = self.maze.fps / speed
         directions = [(sign(MIDDLE - self.x), 0), (0, sign(MIDDLE - self.y))]
         shuffle(directions)
-        directions.append(choice(CROSS))
+        directions.append(choice((choice(ADJACENT_GRIDS), (0, 0))))
         for x, y in directions:
             if (x or y) and self.maze.map[self.x + x][self.y + y] == EMPTY:
                 self.offsetx = round(x * (1 - self.move_speed))