Mercurial > skaapsteker
changeset 146:5eb51736464c
Use floor flag
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Tue, 05 Apr 2011 16:35:30 +0200 |
parents | fec9ed36e9a2 |
children | 887d69907b22 |
files | skaapsteker/physics.py |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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