diff skaapsteker/sprites/player.py @ 271:56a529a69e97

Only backout / move-off "solid" collisions
author Neil Muller <drnlmuller@gmail.com>
date Fri, 08 Apr 2011 17:26:06 +0200
parents c24588c7ba09
children 630ebb87b38a
line wrap: on
line diff
--- a/skaapsteker/sprites/player.py	Fri Apr 08 17:13:25 2011 +0200
+++ b/skaapsteker/sprites/player.py	Fri Apr 08 17:26:06 2011 +0200
@@ -16,6 +16,8 @@
     collides_with = set([MONSTER_LAYER])
     wants_updates = True
 
+    block = True
+
     _max_sprint_time = 2
 
     def __init__(self, the_world, soundsystem):
@@ -155,12 +157,13 @@
         if self.attacking and hasattr(other, 'damage'):
             # FIXME: Check if we're facing the right way
             other.damage(5)
-        if other not in self._last_collide:
+        if other not in self._last_collide and (other.floor or other.block):
             self._last_collide.append(other)
             self._collide_pos = self.collide_rect.midbottom
             self._collisions_seen = 0
-        else:
+        elif other in self._last_collide:
             self._collisions_seen += 1
+        print other, self._collisions_seen, self._last_collide
         if hasattr(other, 'collided_player'):
             other.collided_player(self)
             print 'Health', self.the_world.fox.cur_health