Fix "Non-ASCII character '\xe2'"
This commit is contained in:
parent
8f512966f2
commit
24d2d9d861
@ -198,7 +198,7 @@ class Bunner(MyActor):
|
||||
self.image = "sit" + str(self.direction)
|
||||
elif self.state == PlayerState.SPLASH and self.timer > 84:
|
||||
# Display appropriate 'splash' animation frame. Note that we use a different technique to display the
|
||||
# 'splat' image – see: comments earlier in this method. The reason two different techniques are used is
|
||||
# 'splat' image - see: comments earlier in this method. The reason two different techniques are used is
|
||||
# that the splash image should be drawn on top of other objects, whereas the splat image must be drawn
|
||||
# underneath other objects. Since the player is always drawn on top of other objects, changing the player
|
||||
# sprite is a suitable method of displaying the splash image.
|
||||
@ -283,7 +283,7 @@ class Row(MyActor):
|
||||
def check_collision(self, x):
|
||||
# Returns the new state the player should be in, based on whether or not the player collided with anything on
|
||||
# this road. As this class is the base class for other types of row, this method defines the default behaviour
|
||||
# – i.e. unless a subclass overrides this method, the player can walk around on a row without dying.
|
||||
# - i.e. unless a subclass overrides this method, the player can walk around on a row without dying.
|
||||
return PlayerState.ALIVE, 0
|
||||
|
||||
def allow_movement(self, x):
|
||||
|
||||
@ -501,7 +501,7 @@ class Game:
|
||||
return 0.001 + (0.0001 * min(100, self.level))
|
||||
|
||||
def max_enemies(self):
|
||||
# Maximum number of enemies on-screen at once – increases as you progress through the levels
|
||||
# Maximum number of enemies on-screen at once - increases as you progress through the levels
|
||||
return min((self.level + 6) // 2, 8)
|
||||
|
||||
def next_level(self):
|
||||
|
||||
@ -150,7 +150,7 @@ class Player(Actor):
|
||||
difference = (dir - self.direction)
|
||||
|
||||
# We use the following list to decide how much to rotate by each frame, based on difference.
|
||||
# It's easiest to think about this by just considering the first four direction values – 0 to 3,
|
||||
# It's easiest to think about this by just considering the first four direction values - 0 to 3,
|
||||
# corresponding to facing up, to fit into the bottom right. However, because of the symmetry of the
|
||||
# player sprites as described above, these calculations work for all possible directions.
|
||||
# If there is no difference, no rotation is required.
|
||||
@ -315,12 +315,12 @@ class Bullet(Actor):
|
||||
# Move up the screen, 24 pixels per frame
|
||||
self.y -= 24
|
||||
|
||||
# game.damage checks to see if there is a rock at the given position – if so, it damages
|
||||
# game.damage checks to see if there is a rock at the given position - if so, it damages
|
||||
# the rock and returns True
|
||||
# An asterisk before a list or tuple will unpack the contents into separate values
|
||||
grid_cell = pos2cell(*self.pos)
|
||||
if game.damage(*grid_cell, 1, True):
|
||||
# Hit a rock – destroy self
|
||||
# Hit a rock - destroy self
|
||||
self.done = True
|
||||
else:
|
||||
# Didn't hit a rock
|
||||
@ -656,7 +656,7 @@ class Game:
|
||||
rock = self.grid[cell_y][cell_x]
|
||||
|
||||
if rock != None:
|
||||
# rock.damage returns False if the rock has lost all its health – in this case, the grid cell will be set
|
||||
# rock.damage returns False if the rock has lost all its health - in this case, the grid cell will be set
|
||||
# to None, overwriting the rock object reference
|
||||
if rock.damage(amount, from_bullet):
|
||||
self.grid[cell_y][cell_x] = None
|
||||
@ -703,7 +703,7 @@ class Game:
|
||||
# updated, it will create entries in the occupied set to indicate that other segments should not attempt to
|
||||
# enter its current grid cell. There are two types of entries that are created in the occupied set. One is a
|
||||
# tuple consisting of a pair of numbers, representing grid cell coordinates. The other is a tuple consisting of
|
||||
# three numbers – the first two being grid cell coordinates, the third representing an edge through which a
|
||||
# three numbers - the first two being grid cell coordinates, the third representing an edge through which a
|
||||
# segment is trying to enter a cell.
|
||||
# It is only used for myriapod segments - not rocks. Those are stored in self.grid.
|
||||
self.occupied = set()
|
||||
@ -733,9 +733,9 @@ class Game:
|
||||
self.flying_enemy = FlyingEnemy(self.player.x if self.player else 240)
|
||||
|
||||
if self.segments == []:
|
||||
# No myriapod segments – start a new wave
|
||||
# No myriapod segments - start a new wave
|
||||
# First, ensure there are enough rocks. Count the number of rocks in the grid and if there aren't enough,
|
||||
# create one per frame. Initially there should be 30 rocks – each wave, this goes up by one.
|
||||
# create one per frame. Initially there should be 30 rocks - each wave, this goes up by one.
|
||||
num_rocks = 0
|
||||
for row in self.grid:
|
||||
for element in row:
|
||||
@ -782,7 +782,7 @@ class Game:
|
||||
def sort_key(obj):
|
||||
# Returns a tuple consisting of two elements. The first is whether the object is an instance of the
|
||||
# Explosion class (True or False). A value of true means it will be displayed in front of other objects.
|
||||
# The second element is a number – either the objects why position, or zero if obj is 'None'
|
||||
# The second element is a number - either the objects why position, or zero if obj is 'None'
|
||||
return (isinstance(obj, Explosion), obj.y if obj else 0)
|
||||
|
||||
# Sort list using the above function to determine order
|
||||
|
||||
@ -420,8 +420,8 @@ def allow_movement(x, y):
|
||||
# This is called when a computer-controlled player with the ball is working out which direction to run in, or whether
|
||||
# to pass the ball to another player, or kick it into the goal.
|
||||
# Several things make up the final score:
|
||||
# - the distance to our own goal – further away is better
|
||||
# - the proximity of players on the other team – we want to get the ball away from them as much as possible
|
||||
# - the distance to our own goal - further away is better
|
||||
# - the proximity of players on the other team - we want to get the ball away from them as much as possible
|
||||
# - a quadratic equation (don’t panic too much!) causing the player to favour the centre of the pitch and their opponents goal
|
||||
# - an optional handicap value which can bias the result towards or away from a particular position
|
||||
def cost(pos, team, handicap=0):
|
||||
@ -748,7 +748,7 @@ class Game:
|
||||
# If team 1 just scored (or if it's the start of the game), team 0 will kick off
|
||||
other_team = 1 if self.scoring_team == 0 else 0
|
||||
|
||||
# Players are stored in the players list in an alternating fashion – the first player being on team 0, the
|
||||
# Players are stored in the players list in an alternating fashion - the first player being on team 0, the
|
||||
# second on team 1, the third on team 0 etc. The player that kicks off will always be the first player of
|
||||
# the relevant team.
|
||||
self.kickoff_player = self.players[other_team]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user