summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--brutalmaze/characters.py3
-rw-r--r--brutalmaze/constants.py23
-rw-r--r--brutalmaze/main.py18
-rw-r--r--brutalmaze/misc.py2
-rwxr-xr-xsetup.py4
5 files changed, 19 insertions, 31 deletions
diff --git a/brutalmaze/characters.py b/brutalmaze/characters.py
index 262578e..faa67c4 100644
--- a/brutalmaze/characters.py
+++ b/brutalmaze/characters.py
@@ -19,7 +19,6 @@
 
 __doc__ = 'brutalmaze module for hero and enemy classes'
 
-from collections import deque
 from math import atan, atan2, sin, pi
 from random import choice, randrange, shuffle
 from sys import modules
@@ -138,7 +137,7 @@ class Enemy:
     def get_pos(self):
         """Return coordinate of the center of the enemy."""
         x, y = self.maze.get_pos(self.x, self.y)
-        step = self.maze.distance * HERO_SPEED / self.maze.fps
+        step = self.maze.distance * ENEMY_SPEED / self.maze.fps
         return x + self.offsetx*step, y + self.offsety*step
 
     def get_distance(self):
diff --git a/brutalmaze/constants.py b/brutalmaze/constants.py
index 1e0be20..c30488a 100644
--- a/brutalmaze/constants.py
+++ b/brutalmaze/constants.py
@@ -19,9 +19,20 @@
 
 __doc__ = 'brutalmaze module for shared constants'
 
-from pygame import image, K_UP, K_w, K_LEFT, K_a, K_DOWN, K_s, K_RIGHT, K_d
-from pygame.mixer import Sound
+from os.path import join
+
+from appdirs import user_config_dir, site_config_dir
 from pkg_resources import resource_filename
+from pygame import image
+from pygame.mixer import Sound
+
+USER_CONFIG = join(user_config_dir('brutalmaze'), 'settings.ini')
+SITE_CONFIG = join(site_config_dir('brutalmaze'), 'settings.ini')
+DEFAULT_BINDINGS = {'New game': 'F2', 'Pause': 'p',
+                    'Move left': 'Left', 'Move right': 'Right',
+                    'Move up': 'Up', 'Move down': 'Down',
+                    'Long-range attack': 'Mouse1',
+                    'Close-range attack': 'Mouse3'}
 
 ICON = image.load(resource_filename('brutalmaze', 'icon.png'))
 MUSIC = resource_filename('brutalmaze', 'soundfx/music.ogg')
@@ -34,16 +45,8 @@ SFX_MISSED = resource_filename('brutalmaze', 'soundfx/missed.ogg')
 SFX_HEART = resource_filename('brutalmaze', 'soundfx/heart.ogg')
 SFX_LOSE = resource_filename('brutalmaze', 'soundfx/lose.ogg')
 
-UP = (K_UP, K_w)
-LEFT = (K_LEFT, K_a)
-DOWN = (K_DOWN, K_s)
-RIGHT = (K_RIGHT, K_d)
-
 SQRT2 = 2 ** 0.5
 INIT_SCORE = 5**0.5/2 + 0.5     # golden mean
-INIT_FPS = 30.0
-MAX_FPS = 60.0
-SIZE = 640, 480
 MAZE_SIZE = 10
 ROAD_WIDTH = 5  # grids
 CELL_WIDTH = ROAD_WIDTH * 2     # grids
diff --git a/brutalmaze/main.py b/brutalmaze/main.py
index 9dc7a4c..e1d5279 100644
--- a/brutalmaze/main.py
+++ b/brutalmaze/main.py
@@ -23,26 +23,14 @@ try:                    # Python 3
     from configparser import ConfigParser, NoOptionError, NoSectionError
 except ImportError:     # Python 2
     from ConfigParser import ConfigParser, NoOptionError, NoSectionError
-from os.path import join
 
-from appdirs import user_config_dir, site_config_dir
-from pkg_resources import resource_filename
 import pygame
 from pygame import DOUBLEBUF, KEYDOWN, OPENGL, QUIT, RESIZABLE, VIDEORESIZE
 
-from .constants import *
+from .constants import USER_CONFIG, SITE_CONFIG, DEFAULT_BINDINGS, ICON, MUSIC
 from .maze import Maze
 
 
-USER_CONFIG = join(user_config_dir('brutalmaze'), 'settings.ini')
-SITE_CONFIG = join(site_config_dir('brutalmaze'), 'settings.ini')
-DEFAULT_BINDINGS = {'New game': 'F2', 'Pause': 'p',
-                    'Move left': 'Left', 'Move right': 'Right',
-                    'Move up': 'Up', 'Move down': 'Down',
-                    'Long-range attack': 'Mouse1',
-                    'Close-range attack': 'Mouse3'}
-
-
 def getconf(config, section, option, valtype=str, fallback=None):
     """Return an option value for a given section from a ConfigParser
     object.
@@ -77,7 +65,7 @@ def main():
     scrtype = RESIZABLE
     if getconf(config, 'Graphics', 'OpenGL', bool):
         scrtype |= OPENGL | DOUBLEBUF
-    fps = getconf(config, 'Graphics', 'Maximum FPS', float, 60.0)
+    fps = max_fps = getconf(config, 'Graphics', 'Maximum FPS', float, 60.0)
 
     # Read control configurations
     key, mouse = {}, {}
@@ -144,7 +132,7 @@ def main():
             flash_time.popleft()
             if new_fps < fps:
                 fps -= 1
-            elif fps < MAX_FPS and not maze.paused:
+            elif fps < max_fps and not maze.paused:
                 fps += 5
         maze.update(fps)
         flash_time.append(pygame.time.get_ticks())
diff --git a/brutalmaze/misc.py b/brutalmaze/misc.py
index d58a2ca..130dfa3 100644
--- a/brutalmaze/misc.py
+++ b/brutalmaze/misc.py
@@ -25,8 +25,6 @@ from random import uniform
 import pygame
 from pygame.gfxdraw import filled_polygon, aapolygon
 
-from .constants import MIDDLE
-
 
 def round2(number):
     """Round a number to an int."""
diff --git a/setup.py b/setup.py
index 4f9ff98..8a2421a 100755
--- a/setup.py
+++ b/setup.py
@@ -15,7 +15,7 @@ setup(
     author_email='vn.mcsinyx@gmail.com',
     license='GPLv3+',
     classifiers=[
-        'Development Status :: 3 - Alpha',
+        'Development Status :: 4 - Beta',
         'Environment :: MacOS X',
         'Environment :: Win32 (MS Windows)',
         'Environment :: X11 Applications',
@@ -28,5 +28,5 @@ setup(
     keywords='pygame action-game arcade-game maze',
     packages=['brutalmaze'],
     install_requires=['appdirs', 'pygame>=1.9'],
-    package_data={'brutalmaze': ['icon.png', 'soundfx/*.ogg', 'settings.ini']},
+    package_data={'brutalmaze': ['icon.png', 'soundfx/*.ogg']},
     entry_points={'gui_scripts': ['brutalmaze = brutalmaze:main']})