Update documentation

This commit is contained in:
Nguyễn Gia Phong 2017-11-21 21:49:35 +07:00
parent fffdd969ad
commit 1578586f24
4 changed files with 16 additions and 23 deletions

View File

@ -7,17 +7,17 @@ art style.
.. image:: https://raw.githubusercontent.com/McSinyx/brutalmaze/master/screenshot.png .. 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 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 escape, the maze's border turns into aggressive squares trying to stop him.
job is to help the trigon fight against those evil squares and find a way out Your job is to help the trigon fight against those evil squares and find a way
(if there is any). Be aware that the more get killed, the more will show up and out (if there is any). Be aware that the more get killed, the more will show up
our hero will get weaker when wounded. 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. * Auto-generated and infinite maze.
* No binary data for drawing. * 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. * Somewhat a realistic physic and logic system.
* Resizable game window in-game. * Resizable game window in-game.
@ -29,33 +29,29 @@ The installation procedure should be as simply as follow:
* Install Python and `pip <https://pip.pypa.io/en/latest/>`_. Make sure the * Install Python and `pip <https://pip.pypa.io/en/latest/>`_. Make sure the
directory for `Python scripts <https://docs.python.org/2/install/index.html#alternate-installation-the-user-scheme>`_ directory for `Python scripts <https://docs.python.org/2/install/index.html#alternate-installation-the-user-scheme>`_
is your ``PATH``. is in your ``$PATH``.
* Open Terminal or Command Prompt and run ``pip install --user brutalmaze``. * Open Terminal or Command Prompt and run ``pip install --user brutalmaze``.
Now you can lauch the game by running the command ``brutalmaze``. Now you can lauch the game by running the command ``brutalmaze``.
For more information, see the `Installation <https://github.com/McSinyx/brutalmaze/wiki/Installation>`_
from Brutal Maze wiki.
Control Control
------- -------
F2 F2
New game. New game.
Escape, ``p`` Escape, ``p``
Pause. Pause.
Up, ``w`` Up, ``w``
Move up. Move up.
Down, ``s`` Down, ``s``
Move down. Move down.
Left, ``a`` Left, ``a``
Move left. Move left.
Right, ``d`` Right, ``d``
Move right. Move right.
Left Mouse Left Mouse
Long-range attack. Long-range attack.
Return, Right Mouse Return, Right Mouse
Close-range attack, also dodge from bullets. Close-range attack, also dodge from bullets.

View File

@ -186,14 +186,12 @@ class Enemy:
if self.offsety: if self.offsety:
self.offsety -= sign(self.offsety) self.offsety -= sign(self.offsety)
return True return True
if (self.next_strike > pygame.time.get_ticks() if self.next_strike > pygame.time.get_ticks(): return False
or (self.x, self.y) in AROUND_HERO):
return False
self.move_speed = self.maze.fps / speed self.move_speed = self.maze.fps / speed
directions = [(sign(MIDDLE - self.x), 0), (0, sign(MIDDLE - self.y))] directions = [(sign(MIDDLE - self.x), 0), (0, sign(MIDDLE - self.y))]
shuffle(directions) shuffle(directions)
directions.append(choice(CROSS)) directions.append(choice((choice(ADJACENT_GRIDS), (0, 0))))
for x, y in directions: for x, y in directions:
if (x or y) and self.maze.map[self.x + x][self.y + y] == EMPTY: if (x or y) and self.maze.map[self.x + x][self.y + y] == EMPTY:
self.offsetx = round(x * (1 - self.move_speed)) self.offsetx = round(x * (1 - self.move_speed))

View File

@ -47,7 +47,6 @@ FIRANGE = 6 # grids
BULLET_LIFETIME = 1000.0 * FIRANGE / (BULLET_SPEED-HERO_SPEED) # ms BULLET_LIFETIME = 1000.0 * FIRANGE / (BULLET_SPEED-HERO_SPEED) # ms
EMPTY, WALL, HERO, ENEMY = range(4) EMPTY, WALL, HERO, ENEMY = range(4)
ADJACENT_GRIDS = (1, 0), (0, 1), (-1, 0), (0, -1) 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 AROUND_HERO = set((MIDDLE + x, MIDDLE + y) for x, y in
ADJACENT_GRIDS + ((1, 1), (-1, 1), (-1, -1), (1, -1))) ADJACENT_GRIDS + ((1, 1), (-1, 1), (-1, -1), (1, -1)))

View File

@ -247,7 +247,7 @@ class Maze:
fallen.append(i) fallen.append(i)
for i in reversed(fallen): self.bullets.pop(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 """Return dx or dy if it it valid to move the maze in that
velocity, otherwise return 0.0. velocity, otherwise return 0.0.
""" """
@ -270,9 +270,9 @@ class Maze:
"""Update the maze.""" """Update the maze."""
if self.paused: return if self.paused: return
self.fps = fps self.fps = fps
dx = self.valid_move(vx=self.vx) dx = self.is_valid_move(vx=self.vx)
self.centerx += dx self.centerx += dx
dy = self.valid_move(vy=self.vy) dy = self.is_valid_move(vy=self.vy)
self.centery += dy self.centery += dy
if dx or dy: if dx or dy: