# HG changeset patch # User Neil Muller # Date 1302360818 -7200 # Node ID 55e00f186c6fd005c19626ed8249ee7c4cbf638f # Parent 1501d9b7f5dd1b899e76a180fb27e1c0e2a380e1 imported patch floor_checks diff -r 1501d9b7f5dd -r 55e00f186c6f skaapsteker/physics.py --- a/skaapsteker/physics.py Sat Apr 09 16:50:54 2011 +0200 +++ b/skaapsteker/physics.py Sat Apr 09 16:53:38 2011 +0200 @@ -100,6 +100,10 @@ def collided(self, other): pass + def check_floors(self, floors): + """Trigger of the current set of floors""" + pass + def apply_friction(self): v_x, v_y = self.velocity self.velocity = self.friction_coeff[0] * v_x, self.friction_coeff[1] * v_y @@ -275,20 +279,22 @@ (sprite.collide_rect.left, sprite.collide_rect.bottom), (sprite.collide_rect.width, 1)) collides = contact_rect.colliderect + floors = [] if sprite.on_solid: # Check if we are still in contact with the ground still_on_solid = False for other in self._collision_groups[sprite.collision_layer]: if (other.floor or other.block) and collides(other.floor_rect): still_on_solid = True - break + floors.append(other) sprite.on_solid = still_on_solid else: # Are we currently in contact with the ground for other in self._collision_groups[sprite.collision_layer]: if (other.floor or other.block) and collides(other.floor_rect): sprite.on_solid = True - break + floors.append(other) + sprite.check_floors(floors) # call update methods self._updaters.update()