From 1578586f24c74786976f0c675c901f5e30fa6bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Tue, 21 Nov 2017 21:49:35 +0700 Subject: [PATCH] Update documentation --- README.rst | 26 +++++++++++--------------- brutalmaze/characters.py | 6 ++---- brutalmaze/constants.py | 1 - brutalmaze/maze.py | 6 +++--- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/README.rst b/README.rst index 8e1f484..a48c946 100644 --- a/README.rst +++ b/README.rst @@ -7,17 +7,17 @@ art style. .. image:: https://raw.githubusercontent.com/McSinyx/brutalmaze/master/screenshot.png The game features a trigon trapped in an infinite maze. As our hero tries to -escape, the maze's border turn into aggressive squares trying to stop him. Your -job is to help the trigon fight against those evil squares and find a way out -(if there is any). Be aware that the more get killed, the more will show up and -our hero will get weaker when wounded. +escape, the maze's border turns into aggressive squares trying to stop him. +Your job is to help the trigon fight against those evil squares and find a way +out (if there is any). Be aware that the more get killed, the more will show up +and our hero will get weaker when wounded. -Being a research game, Brutal Maze has a few primary goals: +Brutal Maze has a few notable feautures: -* Highly portable. +* Being highly portable. * Auto-generated and infinite maze. * No binary data for drawing. -* Enemies with randomized attributes: stun, poison, camo, etc. +* Enemies with special abilities: stun, poison, camo, etc. * Somewhat a realistic physic and logic system. * Resizable game window in-game. @@ -29,33 +29,29 @@ The installation procedure should be as simply as follow: * Install Python and `pip `_. Make sure the directory for `Python scripts `_ - is your ``PATH``. + is in your ``$PATH``. * Open Terminal or Command Prompt and run ``pip install --user brutalmaze``. Now you can lauch the game by running the command ``brutalmaze``. +For more information, see the `Installation `_ +from Brutal Maze wiki. + Control ------- F2 New game. - Escape, ``p`` Pause. - Up, ``w`` Move up. - Down, ``s`` Move down. - Left, ``a`` Move left. - Right, ``d`` Move right. - Left Mouse Long-range attack. - Return, Right Mouse Close-range attack, also dodge from bullets. 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)) diff --git a/brutalmaze/constants.py b/brutalmaze/constants.py index 6cc9103..0ffd6a0 100644 --- a/brutalmaze/constants.py +++ b/brutalmaze/constants.py @@ -47,7 +47,6 @@ FIRANGE = 6 # grids BULLET_LIFETIME = 1000.0 * FIRANGE / (BULLET_SPEED-HERO_SPEED) # ms EMPTY, WALL, HERO, ENEMY = range(4) ADJACENT_GRIDS = (1, 0), (0, 1), (-1, 0), (0, -1) -CROSS = ADJACENT_GRIDS + ((0, 0),) AROUND_HERO = set((MIDDLE + x, MIDDLE + y) for x, y in ADJACENT_GRIDS + ((1, 1), (-1, 1), (-1, -1), (1, -1))) diff --git a/brutalmaze/maze.py b/brutalmaze/maze.py index 7634e77..ee02d38 100644 --- a/brutalmaze/maze.py +++ b/brutalmaze/maze.py @@ -247,7 +247,7 @@ class Maze: fallen.append(i) for i in reversed(fallen): self.bullets.pop(i) - def valid_move(self, vx=0.0, vy=0.0): + def is_valid_move(self, vx=0.0, vy=0.0): """Return dx or dy if it it valid to move the maze in that velocity, otherwise return 0.0. """ @@ -270,9 +270,9 @@ class Maze: """Update the maze.""" if self.paused: return self.fps = fps - dx = self.valid_move(vx=self.vx) + dx = self.is_valid_move(vx=self.vx) self.centerx += dx - dy = self.valid_move(vy=self.vy) + dy = self.is_valid_move(vy=self.vy) self.centery += dy if dx or dy: