Fix spawn sound volume

This commit is contained in:
Nguyễn Gia Phong 2018-01-26 22:50:52 +07:00
parent b4c900ec0d
commit f9e4ab3ef1
3 changed files with 11 additions and 5 deletions

View File

@ -141,6 +141,12 @@ class Enemy:
step = self.maze.distance * HERO_SPEED / self.maze.fps
return x + self.offsetx*step, y + self.offsety*step
def get_distance(self):
"""Return the distance from the center of the enemy to
the center of the maze.
"""
return self.maze.get_distance(*self.get_pos())
def place(self, x=0, y=0):
"""Move the enemy by (x, y) (in grids)."""
self.x += x
@ -169,7 +175,8 @@ class Enemy:
if get_distance(x - self.maze.x, y - self.maze.y) <= mind:
return False
self.awake = True
play(self.maze.sfx_spawn, self.maze.get_distance(*self.get_pos()),
play(self.maze.sfx_spawn,
1 - self.get_distance()/self.maze.get_distance(0, 0)/2,
self.get_angle() + pi)
return True
@ -213,8 +220,7 @@ class Enemy:
def get_slash(self):
"""Return the enemy's close-range damage."""
d = self.maze.slashd - self.maze.get_distance(*self.get_pos())
wound = d / self.maze.hero.R
wound = (self.maze.slashd - self.get_distance()) / self.maze.hero.R
return wound if wound > 0 else 0.0
def slash(self):

View File

@ -220,7 +220,7 @@ class Maze:
if not self.hero.spin_queue: return
killist = []
for i, enemy in enumerate(self.enemies):
d = self.slashd - self.get_distance(*enemy.get_pos())
d = self.slashd - enemy.get_distance()
if d > 0:
wound, time = d * SQRT2 / self.distance, get_ticks()
if time >= self.next_slashfx:

View File

@ -7,7 +7,7 @@ with open('README.rst') as f:
setup(
name='brutalmaze',
version='0.4.0',
version='0.4.1',
description='A hash and slash game with fast-paced action and a minimalist art style',
long_description=long_description,
url='https://github.com/McSinyx/brutalmaze',