# HG changeset patch # User Neil Muller # Date 1302014130 -7200 # Node ID 5eb51736464ccd5bd2da5994d40b1c67c125a8de # Parent fec9ed36e9a24a9262e6630ad1c948bbceaa60a0 Use floor flag diff -r fec9ed36e9a2 -r 5eb51736464c skaapsteker/physics.py --- a/skaapsteker/physics.py Tue Apr 05 16:29:13 2011 +0200 +++ b/skaapsteker/physics.py Tue Apr 05 16:35:30 2011 +0200 @@ -34,7 +34,7 @@ debug_color = (240, 0, 0) - is_ground = False # We special case collisions with ground objects + floor = False # We special case collisions with ground objects def __init__(self, *args, **kwargs): super(Sprite, self).__init__(*args, **kwargs) @@ -103,7 +103,7 @@ dv_x = - normal[0] * b_x * v_x dv_y = - normal[1] * b_y * v_y - if normal == (0, 1) and other.is_ground and v_y > 0 and self.collide_rect.top < other.collide_rect.top: + if normal == (0, 1) and other.floor and v_y > 0 and self.collide_rect.top < other.collide_rect.top: # Colliding with the ground from above is special self.on_ground = True dv_y = -v_y @@ -220,7 +220,7 @@ collides = contact_rect.colliderect still_on_ground = False for other in self._collision_groups[sprite.collision_layer]: - if other.is_ground and collides(other.collide_rect): + if other.floor and collides(other.collide_rect): still_on_ground = True break sprite.on_ground = still_on_ground @@ -231,7 +231,7 @@ (sprite.collide_rect.width, 1)) collides = contact_rect.colliderect for other in self._collision_groups[sprite.collision_layer]: - if other.is_ground and collides(other.collide_rect): + if other.floor and collides(other.collide_rect): sprite.on_ground = True break