about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--MANIFEST.in2
-rw-r--r--brutalmaze/characters.py15
-rw-r--r--brutalmaze/constants.py5
-rw-r--r--brutalmaze/game.py12
-rw-r--r--brutalmaze/maze.py25
-rw-r--r--brutalmaze/misc.py10
-rw-r--r--brutalmaze/weapons.py5
-rw-r--r--setup.cfg2
-rwxr-xr-xsetup.py5
9 files changed, 32 insertions, 49 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 4384b67..8141d86 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1 @@
-include README.rst LICENSE screenshot.png
+include LICENSE screenshot.png
diff --git a/brutalmaze/characters.py b/brutalmaze/characters.py
index eb07845..ddb31aa 100644
--- a/brutalmaze/characters.py
+++ b/brutalmaze/characters.py
@@ -1,6 +1,5 @@
-# -*- coding: utf-8 -*-
 # characters.py - module for hero and enemy classes
-# Copyright (C) 2017, 2018  Nguyễn Gia Phong
+# Copyright (C) 2017-2020  Nguyễn Gia Phong
 #
 # This file is part of Brutal Maze.
 #
@@ -45,7 +44,7 @@ class Hero:
         next_beat (float): time until next heart beat (in ms)
         next_strike (float): time until the hero can do the next attack (in ms)
         highness (float): likelihood that the hero shoots toward other angles
-        slashing (bool): flag indicating if the hero is doing close-range attack
+        slashing (bool): flag indicating if the hero's doing close-range attack
         firing (bool): flag indicating if the hero is doing long-range attack
         dead (bool): flag indicating if the hero is dead
         spin_speed (float): speed of spinning (in frames per slash)
@@ -91,8 +90,8 @@ class Hero:
             play(self.sfx_heart)
             self.next_beat = MIN_BEAT*(2 - self.wound/HERO_HP)
         else:
-            self.next_beat -= 1000.0 / fps
-        self.next_strike -= 1000.0 / fps
+            self.next_beat -= 1000 / fps
+        self.next_strike -= 1000 / fps
 
         full_spin = pi * 2 / self.sides
         if self.slashing and self.next_strike <= 0:
@@ -314,7 +313,7 @@ class Enemy:
         if self.awake:
             self.spin_speed, tmp = self.maze.fps / ENEMY_HP, self.spin_speed
             self.spin_queue *= self.spin_speed / tmp
-            self.next_strike -= 1000.0 / self.maze.fps
+            self.next_strike -= 1000 / self.maze.fps
             if not self.spin_queue and not self.fire() and not self.move():
                 self.spin_queue = randsign() * self.spin_speed
                 if not self.maze.hero.dead:
@@ -360,7 +359,7 @@ class Chameleon(Enemy):
     def wake(self):
         """Wake the Chameleon up if it can see the hero."""
         if Enemy.wake(self) is True:
-            self.visible = 1000.0 / ENEMY_SPEED
+            self.visible = 1000 / ENEMY_SPEED
 
     def isunnoticeable(self, x=None, y=None):
         """Return whether the enemy can be noticed.
@@ -375,7 +374,7 @@ class Chameleon(Enemy):
     def update(self):
         """Update the Chameleon."""
         Enemy.update(self)
-        if self.awake: self.visible -= 1000.0 / self.maze.fps
+        if self.awake: self.visible -= 1000 / self.maze.fps
 
     def hit(self, wound):
         """Handle the Chameleon when it's attacked."""
diff --git a/brutalmaze/constants.py b/brutalmaze/constants.py
index 4c10843..1fab35a 100644
--- a/brutalmaze/constants.py
+++ b/brutalmaze/constants.py
@@ -1,6 +1,5 @@
-# -*- coding: utf-8 -*-
 # constants.py - module for shared constants
-# Copyright (C) 2017, 2018  Nguyễn Gia Phong
+# Copyright (C) 2017-2020  Nguyễn Gia Phong
 #
 # This file is part of Brutal Maze.
 #
@@ -56,7 +55,7 @@ BULLET_SPEED = 15   # grid/s
 ATTACK_SPEED = 333.333  # ms/strike
 MAX_WOUND = 1   # per attack turn
 FIRANGE = 6     # grids
-BULLET_LIFETIME = 1000.0 * FIRANGE / (BULLET_SPEED-HERO_SPEED)  # ms
+BULLET_LIFETIME = 1000 * FIRANGE / (BULLET_SPEED-HERO_SPEED)    # ms
 EMPTY, WALL, HERO, ENEMY = range(4)
 ADJACENTS = (1, 0), (0, 1), (-1, 0), (0, -1)
 CORNERS = (1, 1), (-1, 1), (-1, -1), (1, -1)
diff --git a/brutalmaze/game.py b/brutalmaze/game.py
index e8a8b20..f8c3cdd 100644
--- a/brutalmaze/game.py
+++ b/brutalmaze/game.py
@@ -1,6 +1,5 @@
-# -*- coding: utf-8 -*-
 # game.py - main module, starts game and main loop
-# Copyright (C) 2017, 2018  Nguyễn Gia Phong
+# Copyright (C) 2017-2020  Nguyễn Gia Phong
 #
 # This file is part of Brutal Maze.
 #
@@ -17,14 +16,11 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with Brutal Maze.  If not, see <https://www.gnu.org/licenses/>.
 
-__version__ = '0.8.28'
+__version__ = '0.9.0'
 
 import re
 from argparse import ArgumentParser, FileType, RawTextHelpFormatter
-try:                    # Python 3
-    from configparser import ConfigParser
-except ImportError:     # Python 2
-    from ConfigParser import ConfigParser
+from configparser import ConfigParser
 from math import atan2, radians, pi
 from os.path import join as pathjoin, pathsep
 from socket import socket, SOL_SOCKET, SO_REUSEADDR
@@ -136,7 +132,7 @@ class Game:
         self.touch = config.touch
         self.key, self.mouse = config.key, config.mouse
         self.maze = Maze(config.max_fps, config.size, config.headless,
-                         config.export_dir, 1000.0 / config.export_rate)
+                         config.export_dir, 1000 / config.export_rate)
         self.hero = self.maze.hero
         self.clock, self.paused = Clock(), False
 
diff --git a/brutalmaze/maze.py b/brutalmaze/maze.py
index 423b89a..f7ba6e7 100644
--- a/brutalmaze/maze.py
+++ b/brutalmaze/maze.py
@@ -1,6 +1,5 @@
-# -*- coding: utf-8 -*-
 # maze.py - module for the maze class
-# Copyright (C) 2017, 2018  Nguyễn Gia Phong
+# Copyright (C) 2017-2020  Nguyễn Gia Phong
 #
 # This file is part of Brutal Maze.
 #
@@ -35,7 +34,7 @@ from .constants import (
     COLORS, HERO_HP, ENEMY_HP, ATTACK_SPEED, MAX_WOUND, HERO_SPEED,
     BULLET_LIFETIME, JSON_SEPARATORS)
 from .misc import (
-    round2, sign, deg, around, regpoly, fill_aapolygon, play, json_rec)
+    sign, deg, around, regpoly, fill_aapolygon, play, json_rec)
 from .weapons import LockOn
 
 
@@ -84,7 +83,7 @@ class Maze:
 
         self.distance = (self.w * self.h / 416) ** 0.5
         self.x, self.y = self.w // 2, self.h // 2
-        self.centerx, self.centery = self.w / 2.0, self.h / 2.0
+        self.centerx, self.centery = self.w / 2, self.h / 2
         w, h = (int(i/self.distance/2 + 1) for i in size)
         self.rangex = list(range(MIDDLE - w, MIDDLE + w + 1))
         self.rangey = list(range(MIDDLE - h, MIDDLE + h + 1))
@@ -173,8 +172,8 @@ class Maze:
 
     def get_grid(self, x, y):
         """Return the grid containing the point (x, y)."""
-        return (MIDDLE + round2((x-self.centerx) / self.distance),
-                MIDDLE + round2((y-self.centery) / self.distance))
+        return (MIDDLE + round((x-self.centerx) / self.distance),
+                MIDDLE + round((y-self.centery) / self.distance))
 
     def get_target(self, x, y):
         """Return shooting target the grid containing the point (x, y).
@@ -371,7 +370,7 @@ class Maze:
         """Return position of the given coordinates in rounded percent."""
         cx = len(self.rangex)*50 + (x - self.centerx)/self.distance*100
         cy = len(self.rangey)*50 + (y - self.centery)/self.distance*100
-        return round2(cx), round2(cy)
+        return round(cx), round(cy)
 
     def update_export(self, forced=False):
         """Update the maze's data export and return the last record."""
@@ -402,7 +401,7 @@ class Maze:
             if color != '0': export['b'].append([color, x, y, angle])
 
         if self.next_export <= 0:
-            export['t'] = round2(self.export_rate - self.next_export)
+            export['t'] = round(self.export_rate - self.next_export)
             self.export.append(export)
             self.next_export = self.export_rate
         return export
@@ -415,10 +414,10 @@ class Maze:
         self.vy = self.is_valid_move(vy=self.vy)
         self.centery += self.vy
 
-        self.next_move -= 1000.0 / fps
-        self.glitch -= 1000.0 / fps
-        self.next_slashfx -= 1000.0 / fps
-        self.next_export -= 1000.0 / fps
+        self.next_move -= 1000 / fps
+        self.glitch -= 1000 / fps
+        self.next_slashfx -= 1000 / fps
+        self.next_export -= 1000 / fps
 
         self.rotate()
         if self.vx or self.vy or self.hero.firing or self.hero.slashing:
@@ -516,7 +515,7 @@ class Maze:
 
     def reinit(self):
         """Open new game."""
-        self.centerx, self.centery = self.w / 2.0, self.h / 2.0
+        self.centerx, self.centery = self.w / 2, self.h / 2
         self.score, self.export = INIT_SCORE, []
         self.new_map()
         self.vx = self.vy = 0.0
diff --git a/brutalmaze/misc.py b/brutalmaze/misc.py
index fe09035..94a2c39 100644
--- a/brutalmaze/misc.py
+++ b/brutalmaze/misc.py
@@ -1,6 +1,5 @@
-# -*- coding: utf-8 -*-
 # misc.py - module for miscellaneous functions
-# Copyright (C) 2017, 2018  Nguyễn Gia Phong
+# Copyright (C) 2017-2020  Nguyễn Gia Phong
 #
 # This file is part of Brutal Maze.
 #
@@ -31,11 +30,6 @@ from pygame.gfxdraw import filled_polygon, aapolygon
 from .constants import ADJACENTS, CORNERS
 
 
-def round2(number):
-    """Round a number to an int."""
-    return int(round(number))
-
-
 def randsign():
     """Return either -1 or 1 (kind of) randomly."""
     return (pygame.time.get_ticks() & 1)*2 - 1
@@ -66,7 +60,7 @@ def deg(x):
     """Convert angle x from radians to degrees,
     casted to a nonnegative integer.
     """
-    return round2((lambda a: a if a > 0 else a + 360)(degrees(x)))
+    return round((lambda a: a if a > 0 else a + 360)(degrees(x)))
 
 
 def join(iterable, sep=' ', end='\n'):
diff --git a/brutalmaze/weapons.py b/brutalmaze/weapons.py
index 03dfa40..a149841 100644
--- a/brutalmaze/weapons.py
+++ b/brutalmaze/weapons.py
@@ -1,6 +1,5 @@
-# -*- coding: utf-8 -*-
 # characters.py - module for weapon classes
-# Copyright (C) 2017, 2018  Nguyễn Gia Phong
+# Copyright (C) 2017-2020  Nguyễn Gia Phong
 #
 # This file is part of Brutal Maze.
 #
@@ -53,7 +52,7 @@ class Bullet:
         s = distance * BULLET_SPEED / fps
         self.x += s * cos(self.angle)
         self.y += s * sin(self.angle)
-        self.fall_time -= 1000.0 / fps
+        self.fall_time -= 1000 / fps
 
     def get_color(self):
         """Return current color of the enemy."""
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 3c6e79c..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[bdist_wheel]
-universal=1
diff --git a/setup.py b/setup.py
index a8a5ae8..4b350f9 100755
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,4 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python3
 from setuptools import setup
 
 with open('README.rst') as f:
@@ -7,7 +6,7 @@ with open('README.rst') as f:
 
 setup(
     name='brutalmaze',
-    version='0.8.28',
+    version='0.9.0',
     description="Minimalist thrilling shoot 'em up game",
     long_description=long_description,
     url='https://github.com/McSinyx/brutalmaze',