How can I do proper tile collisions? Currently, my code only checks if you are touching a tile and cancels your gravity, setting you in grounded mode. I am not sure how to allow proper tile collisions (touch walls and you stop moving, touch ceilings and your Y velocity cancels and gravity kicks in). Moreover, how can I do loop logic? Usually you are meant to be able to phase through the left side of a loop, collide with the right side, loop halfway and then be able to collide with the left, finish the loop and phase through the right side. Any help is well appreciated. from levels.py: 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 I've tried using rects to get tile.rect.left and tile.rect.right but I want to use mask instead. Continue reading...