Любая справка хорошо ценится.
Код: Выделить всё
for tile in self.tile_group:
# Skip non-collideable tiles and monkey bars for regular collision
if not getattr(tile, "collideable", True) or getattr(tile, "is_monkey_bar", False):
continue
if self.sonic.mask.overlap(tile.mask, (tile.rect.x - self.sonic.hitbox.x, tile.rect.y - self.sonic.hitbox.y)):
if getattr(tile, "loop_left_wall", False) and self.sonic.contact_mode == FLOOR:
self.sonic.angle = 0 # Sonic phases through left loop walls while on the floor
if getattr(tile, "loop_floor", False) and self.sonic.contact_mode in [LEFT_WALL, RIGHT_WALL]:
continue # Sonic phases through loop floors while on the walls
# Sonic collides with the tile
self.sonic.Yvel = 0
self.sonic.grounded = True
self.sonic.jumped = False
self.sonic.angle = tile.angle
break # Stop checking after the first collision
Подробнее здесь: https://stackoverflow.com/questions/795 ... -detection