changeset 253:dff6287b55b7

Prefer downward moves if all things are equal to reduce 'holding oneself against the wall in mid-air' options
author Neil Muller <drnlmuller@gmail.com>
date Fri, 08 Apr 2011 00:43:35 +0200
parents ecd26fafbe70
children 0f502ac5b9e0
files skaapsteker/sprites/player.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/skaapsteker/sprites/player.py	Fri Apr 08 00:43:33 2011 +0200
+++ b/skaapsteker/sprites/player.py	Fri Apr 08 00:43:35 2011 +0200
@@ -127,6 +127,9 @@
                 if clip_area < min_area:
                     min_area = clip_area
                     best_move = attempt
+                elif clip_area == min_area and attempt[1] > best_move[1]:
+                    # Of equal choices, prefer that which moves us downwards
+                    best_move = attempt
             self.collide_rect.move_ip(best_move)
             self.rect.move_ip(best_move)
             self.init_pos()