Changeset 629:59556235dec7


Ignore:
Timestamp:
05/07/11 18:43:12 (12 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Clean up some leftover mess from collision handling work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/physics.py

    r627 r629  
    309309                sprite.collided(col)
    310310            sprite.update_position(cadd(sprite._float_pos, escape_vector))
    311             # if escape_vector[0] != 0:
    312             #     sprite.velocity = (0, sprite.velocity[1])
    313             # if escape_vector[1] != 0:
    314             #     sprite.velocity = (sprite.velocity[0], 1)
    315             # self._backout_collisions(sprite, collisions, dtf)
    316         contact_rect = pygame.Rect(
    317             cadd(sprite.collide_rect.bottomleft, (1, 0)),
    318             (sprite.collide_rect.width, 1))
    319         return contact_rect.colliderect
    320311
    321312
     
    323314        # position update and collision check (do last)
    324315        for sprite in self._mobiles:
    325             collides = self.collide_sprite(dt, sprite)
     316            self.collide_sprite(dt, sprite)
    326317
    327318            # Are we currently in contact with the ground?
    328319            if not sprite.block:
    329320                continue
     321            contact_rect = pygame.Rect(
     322                cadd(sprite.collide_rect.bottomleft, (4, 0)),
     323                (sprite.collide_rect.width - 8, 1))
    330324            floors = []
    331325            sprite.on_solid = False
    332326            for other in self._collision_groups[sprite.collision_layer]:
    333                 if (other.floor or other.block) and collides(other.floor_rect):
     327                if (other.floor or other.block) and contact_rect.colliderect(other.floor_rect):
    334328                    sprite.on_solid = True
    335329                    if sprite.velocity[1] > 0:
Note: See TracChangeset for help on using the changeset viewer.