Changeset 146:5eb51736464c


Ignore:
Timestamp:
Apr 5, 2011, 2:35:30 PM (9 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Message:

Use floor flag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/physics.py

    r144 r146  
    3535    debug_color = (240, 0, 0)
    3636
    37     is_ground = False  # We special case collisions with ground objects
     37    floor = False  # We special case collisions with ground objects
    3838
    3939    def __init__(self, *args, **kwargs):
     
    104104        dv_y = - normal[1] * b_y * v_y
    105105
    106         if normal == (0, 1) and other.is_ground and v_y > 0 and self.collide_rect.top < other.collide_rect.top:
     106        if normal == (0, 1) and other.floor and v_y > 0 and self.collide_rect.top < other.collide_rect.top:
    107107            # Colliding with the ground from above is special
    108108            self.on_ground = True
     
    221221                still_on_ground = False
    222222                for other in self._collision_groups[sprite.collision_layer]:
    223                     if other.is_ground and collides(other.collide_rect):
     223                    if other.floor and collides(other.collide_rect):
    224224                        still_on_ground = True
    225225                        break
     
    232232                collides = contact_rect.colliderect
    233233                for other in self._collision_groups[sprite.collision_layer]:
    234                     if other.is_ground and collides(other.collide_rect):
     234                    if other.floor and collides(other.collide_rect):
    235235                        sprite.on_ground = True
    236236                        break
Note: See TracChangeset for help on using the changeset viewer.