changeset 629:59556235dec7

Clean up some leftover mess from collision handling work.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 07 May 2011 20:43:12 +0200
parents 1fdfc7f03d98
children 2707b33cbcb7
files skaapsteker/physics.py
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/skaapsteker/physics.py	Sat May 07 20:30:25 2011 +0200
+++ b/skaapsteker/physics.py	Sat May 07 20:43:12 2011 +0200
@@ -308,29 +308,23 @@
                     escape_vector = cabsmax(escape_vector, rect_projection(sprite.collide_rect, col.collide_rect))
                 sprite.collided(col)
             sprite.update_position(cadd(sprite._float_pos, escape_vector))
-            # if escape_vector[0] != 0:
-            #     sprite.velocity = (0, sprite.velocity[1])
-            # if escape_vector[1] != 0:
-            #     sprite.velocity = (sprite.velocity[0], 1)
-            # self._backout_collisions(sprite, collisions, dtf)
-        contact_rect = pygame.Rect(
-            cadd(sprite.collide_rect.bottomleft, (1, 0)),
-            (sprite.collide_rect.width, 1))
-        return contact_rect.colliderect
 
 
     def update_sprite_positions(self, dt):
         # position update and collision check (do last)
         for sprite in self._mobiles:
-            collides = self.collide_sprite(dt, sprite)
+            self.collide_sprite(dt, sprite)
 
             # Are we currently in contact with the ground?
             if not sprite.block:
                 continue
+            contact_rect = pygame.Rect(
+                cadd(sprite.collide_rect.bottomleft, (4, 0)),
+                (sprite.collide_rect.width - 8, 1))
             floors = []
             sprite.on_solid = False
             for other in self._collision_groups[sprite.collision_layer]:
-                if (other.floor or other.block) and collides(other.floor_rect):
+                if (other.floor or other.block) and contact_rect.colliderect(other.floor_rect):
                     sprite.on_solid = True
                     if sprite.velocity[1] > 0:
                         sprite.velocity = (sprite.velocity[0], 0)